void FigureCaption(char * caption)
{
+ Window activeClient = null;
+
caption[0] = '\0';
if(this.caption)
strcpy(caption, this.caption);
if(modifiedDocument)
strcat(caption, " *");
}
- if(activeClient && menuBar &&
- activeClient.state == maximized)
+
+ if(menuBar)
+ {
+ for(activeClient = this.activeClient; activeClient && !((BorderBits)activeClient.borderStyle).fixed; activeClient = activeClient.activeClient);
+ }
+ if(activeClient && activeClient.state == maximized)
{
if(activeClient.caption)
{
}
}
+ Window GetParentMenuBar()
+ {
+ Window menuBarParent;
+ for(menuBarParent = this; menuBarParent; menuBarParent = menuBarParent.parent)
+ {
+ if(menuBarParent.menuBar) break;
+ if(menuBarParent.parent && /*menuBarParent != */!menuBarParent.parent.activeClient)
+ {
+ menuBarParent = null;
+ break;
+ }
+ }
+ return menuBarParent ? menuBarParent.menuBar : null;
+ }
+
void CreateSystemChildren(void)
{
Window parent = this;
bool hasClose = false, hasMaxMin = false;
Point scroll = this.scroll;
- if(state == maximized && this.parent.menuBar)
- {
- if(this.parent.activeClient == this)
- parent = this.parent.menuBar;
- else
- parent = null;
- }
+ if(state == maximized)
+ parent = GetParentMenuBar();
if(parent)
{
previous.CreateSystemChildren();
}
}
+
if(menu)
{
MenuItem item;
if(menu)
menu.Clean(this);
- if(activeClient && activeClient.menu && activeClient.state != minimized)
- {
- if(mergeMenus)
- {
- //activeClient.menu.Clean(activeClient);
- menu.Merge(activeClient.menu, true, activeClient);
- }
- }
-
- if(activeChild && activeChild != activeClient && activeChild.menu && activeChild.state != minimized)
- {
- if(mergeMenus)
- menu.Merge(activeChild.menu, true, activeChild);
- }
-
// Build window list
if(activeClient)
{
if(item) item.disabled = !activeClient || !activeClient.style.hasClose;
item = menu.FindItem(MenuFileSaveAll, 0);
if(item) item.disabled = numDocuments < 1;
+
+ if(activeClient && activeClient.menu && activeClient.state != minimized)
+ {
+ if(mergeMenus)
+ {
+ //activeClient.menu.Clean(activeClient);
+ menu.Merge(activeClient.menu, true, activeClient);
+ }
+ }
+
+ if(activeChild && activeChild != activeClient && activeChild.menu && activeChild.state != minimized)
+ {
+ if(mergeMenus)
+ menu.Merge(activeChild.menu, true, activeChild);
+ }
}
// This is called again for a child window change, with same active client
OnActivateClient(activeClient, previous);
+ if(!menuBar && !((BorderBits)borderStyle).fixed && parent && parent.activeClient == this)
+ parent.UpdateActiveDocument(null);
}
void _ShowDecorations(Box box, bool post)
status = false;
break;
}
- if(style.tabCycle ||
- CycleChildren(key.shift, true, false, true))
+ if(style.tabCycle)
{
delete this;
return true;
}
+ if(CycleChildren(key.shift, true, false, true))
+ {
+ status = false;
+ break;
+ }
}
break;
/*
while(true)
{
Window sibling = cycle.data;
- if(sibling.style.isActiveClient)
+ if(sibling.style.isActiveClient && sibling.visible && !sibling.style.nonClient)
{
if(c == id)
break;
{
ItemPtr ptr;
+ // Default width & height for merging menus into menu bars
+ if(isMenuBar)
+ {
+ FontExtent(display, font, "W",1, &maxW, &maxH);
+ if(!guiApp.textMode)
+ maxH += 6;
+ }
+
for(ptr = menu.items.first; ptr; ptr = ptr.next)
{
MenuItem item = ptr.item;
{
Window master = this.master;
Window activeClient = master.activeClient;
+ // TOFIX: Fix need for a cast here...
+ while(activeClient && !((BorderBits)activeClient.borderStyle).fixed)
+ activeClient = activeClient.activeClient;
if(activeClient && activeClient.state == maximized)
activeClient.SetState(normal, false, mods);
}
*w += 2 * BORDER;
*h += TOP + BOTTOM;
}
- if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ if(((BorderBits)borderStyle).fixed && (state != maximized || !GetParentMenuBar()))
{
*h += CAPTION;
if(!((BorderBits)borderStyle).sizable || state == minimized)
{
bool isNormal = (state == normal);
if(nativeDecorations && rootWindow == this) return;
- if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ if(((BorderBits)borderStyle).fixed && (state != maximized || !GetParentMenuBar()))
{
*mw = MIN_WIDTH;
*mh = MIN_HEIGHT;
*y += TOP;
}
- if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ if(((BorderBits)borderStyle).fixed && (state != maximized || !GetParentMenuBar()))
{
*y += CAPTION;
if(!((BorderBits)borderStyle).sizable || state == minimized)
{
bool isNormal = (state == normal);
int top = 0, border = 0, bottom = 0;
+ Window parentMenuBar = GetParentMenuBar() != null;
if(nativeDecorations && rootWindow == this) return;
if(((BorderBits)borderStyle).contour)
{
deepBorder = border;
- deepTop = (((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar)) ? (top + CAPTION) : top;
+ deepTop = (((BorderBits)borderStyle).fixed && (state != maximized || !parentMenuBar)) ? (top + CAPTION) : top;
deepBottom = (((BorderBits)borderStyle).sizable && isNormal) ? bottom : border;
}
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
- if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ if(((BorderBits)borderStyle).fixed && (state != maximized || !parentMenuBar))
{
if(state != maximized || !((BorderBits)borderStyle).sizable)
{
bool result = false;
if(nativeDecorations && rootWindow == this) return false;
- if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ if(((BorderBits\)borderStyle).fixed && (state != maximized || !GetParentMenuBar()))
{
int corner = 0, border = 0, top = 0;
if(((BorderBits)borderStyle).sizable && isNormal)
top = border = DEAD_BORDER;
else if(((BorderBits)borderStyle).sizable)
{
- if(state == maximized && parent.menuBar)
+ if(state == maximized && GetParentMenuBar())
{
top = 2;
border = 2;
designer.parent = parent;
designer.Create();
- toolBox = ((IDE)master).toolBox;
+ toolBox = ((IDEWorkSpace)master).toolBox;
incref toolBox;
// Debugger bug here: value of toolBox appears as 0
- sheet = ((IDE)master).sheet;
+ sheet = ((IDEWorkSpace)master).sheet;
incref sheet;
return true;
}
void AddToolBoxClass(Class _class)
{
- ((IDE)master).toolBox.AddControl(_class);
+ ((IDEWorkSpace)master).toolBox.AddControl(_class);
}
void AddDefaultMethod(Instance instance, Instance classInstance)
bool NotifySelect(DropBox control, DataRow row, Modifiers keyFlags)
{
ObjectInfo selected = (ObjectInfo)(row ? row.tag : null);
- ToolBox toolBox = ((IDE)parent).toolBox;
+ ToolBox toolBox = ((IDEWorkSpace)parent).toolBox;
if(codeEditor && selected)
codeEditor.SelectObject(selected);
properties.Activate();
- // ((IDE)master).SheetSelected(Properties);
+ // ((IDEWorkSpace)master).SheetSelected(Properties);
return true;
}
};
methods.Activate();
- // ((IDE)master).SheetSelected(Methods);
+ // ((IDEWorkSpace)master).SheetSelected(Methods);
return true;
}
};
}
}
-class IDE : Window
+public class ToolBar : public Stacker
{
- nativeDecorations = true;
- icon = { ":icon.png" };
- text = titleECEREIDE;
- background = Color { 85, 85, 85 };
+ direction = horizontal;
+ background = activeBorder;
+ opacity = 1.0f;
+ gap = 0;
+
+ anchor = Anchor { left = 0, right = 0 };
+ clientSize = { h = 32 };
+ borderStyle = bevel;
+}
+
+class IDEMainFrame : Window
+{
+ background = activeBorder;
borderStyle = sizable;
hasMaximize = true;
hasMinimize = true;
hasClose = true;
+ size = { 840, 480 };
+ minClientSize = { 600, 300 };
+ nativeDecorations = true;
+ borderStyle = sizable;
+ hasMaximize = true;
+ hasMinimize = true;
+ hasClose = true;
+ hasMenuBar = true;
+ icon = { ":icon.png" };
+ text = titleECEREIDE;
+
+ Stacker stack
+ {
+ this;
+ menu = { };
+ isActiveClient = true;
+ gap = 0;
+ direction = vertical;
+ background = activeBorder;
+ anchor = { left = 0, top = 0, right = 0, bottom = 0 };
+ };
+
+ ToolBar toolBar
+ {
+ stack, this;
+ size = { h = 32 };
+ };
+
+ IDEWorkSpace ideWorkSpace { stack, this };
+}
+
+define ide = ideMainFrame.ideWorkSpace;
+
+class IDEWorkSpace : Window
+{
+ background = Color { 85, 85, 85 };
+
//tabCycle = true;
hasVertScroll = true;
hasHorzScroll = true;
- hasMenuBar = true;
hasStatusBar = true;
+ isActiveClient = true;
#if 0 //def _DEBUG
//stayOnTop = true;
size = { 800, 600 };
anchor = { top = 0, right = 0, bottom = 0 };
#else
- state = maximized;
+ //state = maximized;
anchor = { left = 0, top = 0, right = 0, bottom = 0 };
#endif
menu = Menu { };
Menu recentFiles { fileMenu, $"Recent Files", r };
Menu recentProjects { fileMenu, $"Recent Projects", p };
MenuDivider { fileMenu };
- MenuItem exitItem { fileMenu, $"Exit", x, altF4, NotifySelect = MenuFileExit };
+ MenuItem exitItem
+ {
+ fileMenu, $"Exit", x, altF4, NotifySelect = MenuFileExit;
+
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ ideMainFrame.Destroy(0);
+ return true;
+ }
+ };
bool FileRecentFile(MenuItem selection, Modifiers mods)
{
// Leave it after Create to avoid flicker due to seeing IDE without a project view
projectView.workspace = workspace;
projectView.project = project;
- SetText("%s - %s", project.topNode.name, titleECEREIDE);
+ ideMainFrame.SetText("%s - %s", project.topNode.name, titleECEREIDE);
AdjustMenus();
if(document)
document.fileName = filePath;
- SetText("%s - %s", filePath, titleECEREIDE);
+ ideMainFrame.SetText("%s - %s", filePath, titleECEREIDE);
// this crashes on starting ide with epj file, solution please?
// app.UpdateDisplay();
workspace.timer.Stop();
workspace.Save();
}
+ ideMainFrame.Destroy(0);
return true;
}
}
}
- IDE()
+ IDEWorkSpace()
{
// Graphics Driver Menu
int c;
}
}
- ~IDE()
+ ~IDEWorkSpace()
{
delete driverItems;
delete skinItems;
}
}
-IDE ide { };
+IDEMainFrame ideMainFrame { };
define app = ((IDEApp)__thisModule);
#ifdef _DEBUG