mirror of
https://github.com/leozide/leocad
synced 2025-01-29 20:34:50 +01:00
Implemented Reset All Views and removed view border.
This commit is contained in:
parent
1150db8fb9
commit
9469e2bdef
3 changed files with 56 additions and 96 deletions
|
@ -1575,6 +1575,9 @@ void Project::UpdateAllViews()
|
|||
// Returns true if the active view changed.
|
||||
bool Project::SetActiveView(View* view)
|
||||
{
|
||||
m_ActiveView = view;
|
||||
return false;
|
||||
/*
|
||||
if (view == m_ActiveView)
|
||||
return false;
|
||||
|
||||
|
@ -1595,6 +1598,7 @@ bool Project::SetActiveView(View* view)
|
|||
}
|
||||
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2860,16 +2864,12 @@ void Project::RenderOverlays(int Viewport)
|
|||
|
||||
void Project::RenderViewports(bool bBackground, bool bLines)
|
||||
{
|
||||
float x, y, w, h;
|
||||
int vp;
|
||||
|
||||
glViewport(0, 0, m_nViewX, m_nViewY);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, m_nViewX, 0, m_nViewY, -1, 1);
|
||||
glOrtho(0.0f, m_nViewX, 0.0f, m_nViewY, -1.0f, 1.0f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.375, 0.375, 0.0);
|
||||
glTranslatef(0.375f, 0.375f, 0.0f);
|
||||
|
||||
if (bLines)
|
||||
{
|
||||
|
@ -2879,59 +2879,15 @@ void Project::RenderViewports(bool bBackground, bool bLines)
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
m_pScreenFont->MakeCurrent();
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
for (vp = 0; vp < viewports[m_nViewportMode].n; vp++)
|
||||
{
|
||||
x = viewports[m_nViewportMode].dim[vp][0] * (float)m_nViewX;
|
||||
y = viewports[m_nViewportMode].dim[vp][1] * (float)m_nViewY;
|
||||
w = viewports[m_nViewportMode].dim[vp][2] * (float)(m_nViewX - 1);
|
||||
h = viewports[m_nViewportMode].dim[vp][3] * (float)(m_nViewY - 1);
|
||||
m_pScreenFont->PrintText(3.0f, (float)(m_nViewY - 1.0f) - 6.0f, 0.0f, m_pViewCameras[0]->GetName());
|
||||
|
||||
m_pScreenFont->PrintText(x + 3, y + h - 6, 0.0f, m_pViewCameras[vp]->GetName());
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
// Borders
|
||||
if (m_fLineWidth != 1.0f)
|
||||
glLineWidth (1.0f);
|
||||
|
||||
for (vp = 0; vp < viewports[m_nViewportMode].n; vp++)
|
||||
{
|
||||
if (vp == m_nActiveViewport)
|
||||
continue;
|
||||
|
||||
x = viewports[m_nViewportMode].dim[vp][0] * (float)m_nViewX;
|
||||
y = viewports[m_nViewportMode].dim[vp][1] * (float)m_nViewY;
|
||||
w = viewports[m_nViewportMode].dim[vp][2] * (float)(m_nViewX - 1);
|
||||
h = viewports[m_nViewportMode].dim[vp][3] * (float)(m_nViewY - 1);
|
||||
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f(x, y);
|
||||
glVertex2f(x+w, y);
|
||||
glVertex2f(x+w, y+h);
|
||||
glVertex2f(x, y+h);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
x = viewports[m_nViewportMode].dim[m_nActiveViewport][0] * (float)m_nViewX;
|
||||
y = viewports[m_nViewportMode].dim[m_nActiveViewport][1] * (float)m_nViewY;
|
||||
w = viewports[m_nViewportMode].dim[m_nActiveViewport][2] * (float)(m_nViewX - 1);
|
||||
h = viewports[m_nViewportMode].dim[m_nActiveViewport][3] * (float)(m_nViewY - 1);
|
||||
|
||||
glColor3f(1.0f, 0, 0);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f(x, y);
|
||||
glVertex2f(x+w, y);
|
||||
glVertex2f(x+w, y+h);
|
||||
glVertex2f(x, y+h);
|
||||
glEnd();
|
||||
|
||||
if (m_fLineWidth != 1.0f)
|
||||
glLineWidth (m_fLineWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -752,8 +752,8 @@ void CCADView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
|
|||
|
||||
void CCADView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
|
||||
{
|
||||
if (pActivateView && pActivateView->IsKindOf(RUNTIME_CLASS(CCADView)))
|
||||
lcGetActiveProject()->SetActiveView(((CCADView*)pActivateView)->m_pView);
|
||||
// if (pActivateView && pActivateView->IsKindOf(RUNTIME_CLASS(CCADView)))
|
||||
// lcGetActiveProject()->SetActiveView(((CCADView*)pActivateView)->m_pView);
|
||||
|
||||
CView::OnActivateView(bActivate, pActivateView, pDeactiveView);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define TOOLBAR_VERSION 1
|
||||
|
||||
void mainframe_listener (int message, void *data, void *user)
|
||||
{
|
||||
if (message == LC_MSG_FOCUS_CHANGED)
|
||||
|
@ -239,9 +237,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
// ShowPane(&m_wndModifyDlg, FALSE, FALSE, FALSE);
|
||||
|
||||
// if (theApp.GetProfileInt(_T("Settings"), _T("ToolBarVersion"), 0) == TOOLBAR_VERSION)
|
||||
// LoadBarState("Toolbars");
|
||||
|
||||
// UpdateMenuAccelerators();
|
||||
|
||||
if (m_wndInvisibleToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, ID_VIEW_INVISIBLE_BAR))
|
||||
|
@ -1349,7 +1344,8 @@ void CMainFrame::UpdateMenuAccelerators()
|
|||
|
||||
void CMainFrame::OnDropFiles(HDROP hDropInfo)
|
||||
{
|
||||
SetActiveWindow(); // activate us first !
|
||||
SetActiveWindow();
|
||||
|
||||
UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
|
||||
|
||||
if (nFiles > 0)
|
||||
|
@ -1359,6 +1355,7 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo)
|
|||
|
||||
lcGetActiveProject()->OpenProject(szFileName);
|
||||
}
|
||||
|
||||
::DragFinish(hDropInfo);
|
||||
}
|
||||
|
||||
|
@ -1403,8 +1400,12 @@ void CMainFrame::OnViewSplitVertically()
|
|||
NewSplitter->SetColumnInfo(0, Width, 0);
|
||||
NewSplitter->CreateView(0, 1, RUNTIME_CLASS(CCADView), CSize(Width, Height), NULL);
|
||||
|
||||
CWnd* NewView = NewSplitter->GetPane(0, 1);
|
||||
NewView->ModifyStyleEx(0, WS_EX_CLIENTEDGE);
|
||||
|
||||
RecalcLayout();
|
||||
ParentSplitter->RecalcLayout();
|
||||
ParentSplitter->Invalidate();
|
||||
}
|
||||
|
||||
void CMainFrame::OnViewSplitHorizontally()
|
||||
|
@ -1448,8 +1449,13 @@ void CMainFrame::OnViewSplitHorizontally()
|
|||
NewSplitter->SetRowInfo(0, Height, 0);
|
||||
NewSplitter->CreateView(1, 0, RUNTIME_CLASS(CCADView), CSize(Width, Height), NULL);
|
||||
|
||||
CWnd* NewView = NewSplitter->GetPane(1, 0);
|
||||
NewView->ModifyStyleEx(0, WS_EX_CLIENTEDGE);
|
||||
|
||||
RecalcLayout();
|
||||
ParentSplitter->RecalcLayout();}
|
||||
ParentSplitter->RecalcLayout();
|
||||
ParentSplitter->Invalidate();
|
||||
}
|
||||
|
||||
void CMainFrame::OnViewDeleteView()
|
||||
{
|
||||
|
@ -1535,44 +1541,42 @@ void CMainFrame::OnViewDeleteView()
|
|||
|
||||
void CMainFrame::OnViewResetViews()
|
||||
{
|
||||
/*
|
||||
CView* view = GetActiveView();
|
||||
CDynamicSplitterWnd* parent = (CDynamicSplitterWnd*)view->GetParent();
|
||||
CView* ActiveView = GetActiveView();
|
||||
|
||||
if (!view->IsKindOf(RUNTIME_CLASS(CCADView)))
|
||||
if (!ActiveView->IsKindOf(RUNTIME_CLASS(CCADView)))
|
||||
return;
|
||||
|
||||
CWnd* Parent = ActiveView->GetParent();
|
||||
|
||||
if (Parent == this)
|
||||
return;
|
||||
|
||||
CDynamicSplitterWnd* ParentSplitter = (CDynamicSplitterWnd*)Parent;
|
||||
int Row, Col;
|
||||
|
||||
ParentSplitter->GetViewRowCol(ActiveView, &Row, &Col);
|
||||
ParentSplitter->DetachWindow(Row, Col);
|
||||
|
||||
CWnd* TopSplitter = ParentSplitter;
|
||||
for (CWnd* NextParent = TopSplitter; NextParent != this; NextParent = NextParent->GetParent())
|
||||
TopSplitter = NextParent;
|
||||
|
||||
ParentSplitter->DestroyWindow();
|
||||
|
||||
for (int i = 0; i < m_SplitterList.GetSize(); i++)
|
||||
{
|
||||
CWnd* Sibling = &m_wndSplitter;
|
||||
|
||||
while (!Sibling->IsKindOf(RUNTIME_CLASS(CCADView)))
|
||||
Sibling = ((CDynamicSplitterWnd*)Sibling)->GetPane(0, 0);
|
||||
|
||||
view = (CView*)Sibling;
|
||||
parent = (CDynamicSplitterWnd*)view->GetParent();
|
||||
}
|
||||
|
||||
// Don't do anything if there's only one view.
|
||||
if (parent != &m_wndSplitter)
|
||||
{
|
||||
// Save the active view.
|
||||
int Row, Col;
|
||||
parent->GetViewRowCol(view, &Row, &Col);
|
||||
parent->DetachWindow(Row, Col);
|
||||
|
||||
// Delete all other views.
|
||||
m_wndSplitter.GetPane(0, 0)->DestroyWindow();
|
||||
|
||||
for (int i = 0; i < m_SplitterList.GetSize(); i++)
|
||||
if (m_SplitterList[i] == ParentSplitter)
|
||||
{
|
||||
delete m_SplitterList[i];
|
||||
m_SplitterList.RemoveAll();
|
||||
|
||||
// Add the active view back.
|
||||
m_wndSplitter.AttachWindow(view, 0, 0);
|
||||
m_wndSplitter.RecalcLayout();
|
||||
SetActiveView(view);
|
||||
m_SplitterList.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Load default view layout.
|
||||
const char* str = main_window->GetViewLayout(false);
|
||||
SetViewLayout(NULL, str);
|
||||
*/
|
||||
ActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
|
||||
ActiveView->SetParent(this);
|
||||
ActiveView->ShowWindow(SW_SHOW);
|
||||
ActiveView->InvalidateRect(NULL);
|
||||
|
||||
RecalcLayout();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue