// *** The Old Color Scheme that was causing me auras and ophtalmic migraines -- Uncomment at your own risk! ***
/*
-FontResource panelFont { "Courier New", 10 };
-FontResource codeFont { "Courier New", 10 };
+FontResource panelFont { $"Courier New", 10 };
+FontResource codeFont { $"Courier New", 10 };
Color selectionColor = Color { 10, 36, 106 };
Color selectionText = white;
Color viewsBackground = white;
// The new nice dark scheme -- so peaceful on my brain
-FontResource panelFont { "Courier New", 10 };
-FontResource codeFont { "Courier New", 10 };
+FontResource panelFont { $"Courier New", 10 };
+FontResource codeFont { $"Courier New", 10 };
/*
-FontResource panelFont { "Consolas", 10.5f };
-FontResource codeFont { "Consolas", 10.5f };
+FontResource panelFont { $"Consolas", 12 };
+FontResource codeFont { $"Consolas", 12 };
*/
Color selectionColor = lightYellow;
Color selectionText = Color { 30, 40, 50 };
extern int __attribute__((__stdcall__)) __ecereDll_Unload_ecere(struct __ecereNameSpace__ecere__com__Instance * module);
#endif
-static FileFilter fileFilters[] =
-{
- {
- "C/C++/eC Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, *.hxx)",
- "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx"
- },
- {
- "Header Files for C/C++ (*.eh, *.h, *.hpp, *.hh, *.hxx)",
- "eh, h, hpp, hh, hxx"
- },
- {
- "C/C++/eC Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)",
- "ec, c, cpp, cc, cxx"
- },
- {
- "Text files (*.txt)",
- "txt"
- },
- { "All files", null }
-};
-
-static FileType fileTypes[] =
-{
- { "eC Source Code", "ec", whenNoneGiven },
- { "Text Files", "txt", never }
-};
-
-static char * iconNames[] =
+static Array<FileFilter> fileFilters
+{ [
+ { $"C/C++/eC Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, *.hxx)", "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx" },
+ { $"Header Files for C/C++ (*.eh, *.h, *.hpp, *.hh, *.hxx)", "eh, h, hpp, hh, hxx" },
+ { $"C/C++/eC Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)", "ec, c, cpp, cc, cxx" },
+ { $"Text files (*.txt)", "txt" },
+ { $"All files", null }
+] };
+
+static Array<FileType> fileTypes
+{ [
+ { $"eC Source Code", "ec", whenNoneGiven },
+ { $"Text Files", "txt", never }
+] };
+
+static const char * iconNames[] =
{
"<:ecere>constructs/class.png",
"<:ecere>constructs/data.png",
extern int __ecereVMethodID_class_OnSaveEdit;
extern int __ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad;
+class RTCMenuBits
+{
+public:
+ bool ignoreBreakpoints:1;
+ bool atSameLevel:1;
+ bool oldImplementation:1;
+};
+
class EditFileDialog : FileDialog
{
bool OnCreate()
EditFileDialog codeEditorFileDialog
{
- type = multiOpen, text = "Open",
- types = fileTypes, sizeTypes = sizeof(fileTypes);
- filters = fileFilters, sizeFilters = sizeof(fileFilters)
+ type = multiOpen, text = $"Open",
+ types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType);
+ filters = fileFilters.array, sizeFilters = fileFilters.count * sizeof(FileFilter)
};
EditFileDialog codeEditorFormFileDialog
{
- type = open, text = "Open Project",
- types = fileTypes, sizeTypes = sizeof(fileTypes), filters = fileFilters, sizeFilters = sizeof(fileFilters)
+ type = open, text = $"Open Project",
+ types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType),
+ filters = fileFilters.array, sizeFilters = fileFilters.count * sizeof(FileFilter)
};
define OpenBracket = '{';
enum MethodAction
{
- actionAddMethod = 1,
- actionDeleteMethod = 2,
- actionDetachMethod = 3,
- actionAttachMethod = 4,
+ actionAddMethod = 1,
+ actionDeleteMethod = 2,
+ actionDetachMethod = 3,
+ actionAttachMethod = 4,
actionReattachMethod = 5
};
File fileInput;
-bool parseError = false;
-
int returnCode;
Class insideClass;
ClassFunction insideFunction;
ClassDef insideDef;
Type instanceType;
-char * instanceName;
+const char * instanceName;
Type functionType;
int paramsID;
bool insideInstance;
GENERATING
****************************************************************************/
-static void OutputString(File f, char * string)
+static void OutputString(File f, const char * string)
{
int c;
for(c = 0; string[c]; c++)
f.Puts("\\\"");
else if(string[c] == '\\')
f.Puts("\\\\");
+ else if(string[c] == '\n')
+ {
+ f.Puts("\\n");
+ if(c > 30)
+ f.Puts("\"\n \"");
+ }
else
f.Putc(string[c]);
- }
+ }
}
+// Consider merging with PrintType ?
void OutputType(File f, Type type, bool outputName)
{
if(type)
{
+ if(type.kind != pointerType && type.constant)
+ f.Printf("const ");
switch(type.kind)
{
case voidType:
f.Printf("double");
break;
case classType:
- // ADD CODE TO DECIDE WHETHER TO OUTPUT FULLY QUAlIFIED OR NOT:
- f.Printf(type._class.shortName ? type._class.shortName : type._class.string);
+ {
+ if(type._class && !strcmp(type._class.string, "class"))
+ {
+ switch(type.classObjectType)
+ {
+ case anyObject:
+ f.Printf("any_object");
+ break;
+ default:
+ f.Printf("typed_object");
+ break;
+ }
+ if(type.byReference)
+ f.Printf(" &");
+ }
+ else
+ // ADD CODE TO DECIDE WHETHER TO OUTPUT FULLY QUAlIFIED OR NOT:
+ f.Printf(type._class.shortName ? type._class.shortName : type._class.string);
break;
+ }
case structType:
break;
case unionType:
case pointerType:
OutputType(f, type.type, false);
f.Printf(" *");
+ if(type.constant)
+ f.Printf(" const");
break;
case ellipsisType:
f.Printf("...");
{
char ch;
int before = 0;
-
+
if(position)
f.Seek(pos - *position, current);
-
+
// Try to delete spaces and \n before...
f.Seek(-1, current);
for(;f.Getc(&ch);)
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
// Cut & Paste function
-
+
{
EditLine l1, l2;
int y1,x1,y2,x2;
*text = new char[*size+1 + (y2-y1+1) * linePad + pad]; // Add pad for tabs and new name
editBox.GetSel(*text, false);
}
-
+
editBox.SetSelPos(l1, y1, x1, l2, y2, x2);
f.Printf(""); // Make the stream point to where the editbox is
}
+static int64 GetI64EnumValue(Class dataType, DataValue dataForm)
+{
+ int64 i64Value = 0;
+ switch(dataType.typeSize)
+ {
+ case 1:
+ if(!strcmp(dataType.dataTypeString, "byte"))
+ i64Value = dataForm.uc;
+ else
+ i64Value = dataForm.c;
+ break;
+ case 2:
+ if(!strcmp(dataType.dataTypeString, "uint16"))
+ i64Value = dataForm.us;
+ else
+ i64Value = dataForm.s;
+ break;
+ case 4:
+ if(!strcmp(dataType.dataTypeString, "uint"))
+ i64Value = dataForm.ui;
+ else
+ i64Value = dataForm.i;
+ break;
+ case 8:
+ if(!strcmp(dataType.dataTypeString, "uint64"))
+ i64Value = *(int64 *)&dataForm.ui64;
+ else
+ i64Value = dataForm.i64;
+ break;
+ }
+ return i64Value;
+}
+
void Code_FixProperty(Property prop, Instance object)
{
Designer::FixProperty(prop, object);
if(prop.dataTypeString && (!prop.IsSet || prop.IsSet(selected.instance)))
{
Class dataType = prop.dataTypeClass;
- char string[1024] = "";
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(test._class.module, prop.dataTypeString);
{
void * dataForm = new0 byte[dataType.structSize];
void * dataTest = new0 byte[dataType.structSize];
-
- prop.Get(selected.instance, dataForm);
- prop.Get(test, dataTest);
- if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+ ((void (*)(void *, void *))(void *)prop.Get)(selected.instance, dataForm);
+ ((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
+
+ if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
- prop.Set(test, dataForm);
+ ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
result = true;
}
delete dataForm;
else if(dataType && dataType._vTbl && (dataType.type == normalClass || dataType.type == noHeadClass))
{
void * dataForm, * dataTest;
-
- dataForm = (void *)prop.Get(selected.instance);
- dataTest = (void *)prop.Get(test);
-
- if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+ bool isEditBoxContents = false;
+ bool freeDataForm = false, freeDataTest = false;
+
+ // Because contents property is broken for mutiline EditBox at the moment
+ if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox"))
+ isEditBoxContents = true;
+
+ if(isEditBoxContents && ((EditBox)selected.instance).multiLine)
+ {
+ dataForm = ((EditBox)selected.instance).multiLineContents;
+ freeDataForm = true;
+ }
+ else
+ dataForm = ((void *(*)(void *))(void *)prop.Get)(selected.instance);
+ if(isEditBoxContents && ((EditBox)test).multiLine)
+ {
+ dataTest = ((EditBox)test).multiLineContents;
+ freeDataTest = true;
+ }
+ else
+ dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+
+ if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
- prop.Set(test, dataForm);
+ ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
result = true;
}
+
+ // Temporary work around until we standardize how properties should manage memory
+ if(!strcmp(prop.name, "strings") && !strcmp(prop._class.name, "DirectoriesBox"))
+ freeDataForm = freeDataTest = true;
+ if(dataType.type == normalClass && dataType.structSize)
+ {
+ if(freeDataForm) eInstance_Delete(dataForm);
+ if(freeDataTest) eInstance_Delete(dataTest);
+ }
+ else
+ {
+ if(freeDataForm) delete dataForm;
+ if(freeDataTest) delete dataTest;
+ }
}
else if(dataType && dataType._vTbl)
{
DataValue dataForm, dataTest;
-
+
GetProperty(prop, selected.instance, &dataForm);
GetProperty(prop, test, &dataTest);
-
- if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+
+ if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
{
SetProperty(prop, test, dataForm);
if(strcmp(prop.name, "name"))
{
GetProperty(prop, selected.instance, &dataTest);
- if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+ if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
SetProperty(prop, selected.instance, dataForm);
}
result = true;
- }
+ }
}
}
return result;
}
-bool Code_IsPropertyDisabled(ObjectInfo selected, char * name)
+bool Code_IsPropertyDisabled(ObjectInfo selected, const char * name)
{
bool disabled = false;
if(selected.oClass == selected)
{
- ClassDef def;
+ ClassDef def;
if(selected.classDefinition)
{
for(def = selected.classDefinition.definitions->first; def; def = def.next)
static bool CheckCompatibleMethod(Method method, Type type, Class regClass, bool isForm, Symbol selectedClass)
{
- bool result = false;
+ bool result = false;
bool reset = false;
if(!method.dataType)
method.dataType = ProcessTypeString(method.dataTypeString, false);
method.dataType.thisClass = selectedClass;
}
//result = MatchTypes(method.dataType, type, null, regClass, regClass, false);
- result = MatchTypes(type, method.dataType, null, regClass, regClass, false, true, true, false);
+ result = MatchTypes(type, method.dataType, null, regClass, regClass, false, true, true, false, true);
if(reset)
method.dataType.thisClass = null;
return result;
method.dataType = ProcessTypeString(method.dataTypeString, false);
confirmation = false;
-
+
// Check if default function should be calling base class:
if(object.instance._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
{
else
{
if(stmt)
- confirmation = true;
+ confirmation = true;
}
}
else
}
if(!exp || exp.type != callExp || exp.call.exp.type != identifierExp)
- confirmation = true;
+ confirmation = true;
else
{
Identifier id = exp.call.exp.identifier;
arg = arg ?arg.next : null;
}
}
- }
+ }
}
}
}
isActiveClient = true;
anchor = Anchor { left = 300, right = 150, top = 0, bottom = 0 };
menu = Menu { };
-
- // eWindow_SetX(A_CASCADE); eWindow_SetY(A_CASCADE);
+
+ // eWindow_SetX(A_CASCADE); eWindow_SetY(A_CASCADE);
// eWindow_SetWidth(A_RELATIVE|80); eWindow_SetHeight(A_RELATIVE|80);
SheetType sheetSelected;
OldList * ast;
Context globalContext { };
- OldList excludedSymbols { offset = (uint)&((Symbol)0).left };
+ OldList excludedSymbols { offset = (uint)(uintptr)&((Symbol)0).left };
OldList defines;
OldList imports;
OldList classes;
bool codeModified;
bool formModified;
-
+
ObjectInfo selected;
ObjectInfo oClass;
char methodName[1024];
bool updatingCode;
+ bool loadingFile;
bool fixCaret;
bool membersListShown;
bool membersAbove;
bool expectingMove;
BitmapResource icons[CodeObjectType];
-
- FontResource boldFont { "Tahoma", 8.25f, bold = true, window = this };
- FontResource normalFont { "Tahoma", 8.25f, window = this };
+
+ FontResource boldFont { $"Tahoma", 8.25f, bold = true, window = this };
+ FontResource normalFont { $"Tahoma", 8.25f, window = this };
Module privateModule;
NameSpace globalData;
Designer designer { codeEditor = this, visible = false, saveDialog = codeEditorFormFileDialog };
+ bool noParsing;
+ int maxLineNumberLength;
+
+ property bool parsing { get { return editBox.syntaxHighlighting && !noParsing && !ide.noParsing; } };
+
void ProcessCaretMove(EditBox editBox, int line, int charPos)
{
char temp[512];
// OnActivateClient is called after OnActivate
if(!updatingCode)
{
- sprintf(temp, "Ln %d, Col %d", line, editBox.column + 1);
+ sprintf(temp, $"Ln %d, Col %d", line, editBox.column + 1);
ide.pos.text = temp;
}
if(sheet.codeEditor != this) return;
-
+
if(!updatingCode)
{
for(classItem = classes.first; classItem; classItem = classItem.next)
//Update(null);
}
- sprintf(temp, "Ln %d, Col %d", line, editBox.column + 1);
+ sprintf(temp, $"Ln %d, Col %d", line, editBox.column + 1);
ide.pos.text = temp;
if(expectingMove)
hide = true;
else
{
- char * buffer = membersLine.text;
int c;
if(charPos - 1 < membersLoc.start.charPos)
hide = true;
else if(charPos - 1 > membersLoc.end.charPos)
{
- char * buffer = membersLine.text;
+ const char * buffer = membersLine.text;
//if(membersList.currentRow)
// hide = true;
//else
ProjectView projectView = ide.projectView;
if(projectView)
{
- ProjectNode node = projectView.GetNodeFromWindow(this, null);
- if(node)
+ char buffer[MAX_LOCATION];
+ char * fullPath = GetSlashPathBuffer(buffer, fileName);
+ Array<ProjectNode> nodes = ide.workspace.GetAllProjectNodes(fullPath, false);
+ if(nodes)
{
- node.modified = modifiedDocument;
+ for(node : nodes)
+ node.modified = modifiedDocument;
projectView.Update(null);
}
+ delete nodes;
}
};
EditBox editBox
{
textVertScroll = true, multiLine = true, /*lineNumbers = ideSettings.showLineNumbers,*/
- freeCaret = ideSettings.useFreeCaret, caretFollowsScrolling = ideSettings.caretFollowsScrolling,
+ freeCaret = ideSettings.useFreeCaret, caretFollowsScrolling = ideSettings.caretFollowsScrolling,
tabKey = true, smartHome = true;
- tabSelection = true, maxLineSize = 65536, parent = this, hasHorzScroll = true, hasVertScroll = true;
+ tabSelection = true, /*maxLineSize = 65536, */parent = this, hasHorzScroll = true, hasVertScroll = true;
selectionColor = selectionColor, selectionText = selectionText,
background = codeEditorBG, foreground = codeEditorFG, syntaxColorScheme = colorScheme,
font = font, borderStyle = none;
int oldLine = lastLine;
display.FontExtent(font.font, " ", 1, null, &spaceH);
{
- Box box { 0, (Min(oldLine,oldLine)-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, (Max(oldLine, oldLine))*spaceH-1 - editBox.scroll.y };
+ Box box { 0, (oldLine-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, oldLine*spaceH-1 - editBox.scroll.y };
Update(box);
}
{
- Box box { 0, (Min(line,line)-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, (Max(line, line))*spaceH-1 - editBox.scroll.y };
+ Box box { 0, (line-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, line*spaceH-1 - editBox.scroll.y };
Update(box);
}
lastLine = line;
void NotifyOvrToggle(EditBox editBox, bool overwrite)
{
- ide.ovr.color = overwrite ? black : Color { 128, 128, 128 };
+ ide.UpdateStateLight(ide.ovr, overwrite);
}
void NotifyUpdate(EditBox editBox)
bool NotifyCharsAdded(EditBox editBox, BufferLocation before, BufferLocation after, bool pasteOperation)
{
- if(!updatingCode)
+ if(!loadingFile && after.y != before.y)
{
- ObjectInfo oClass;
-
- if(after.y != before.y)
+ ProjectView projectView = ide.projectView;
+ if(projectView && fileName)
{
- ProjectView projectView = ide.projectView;
- if(projectView && fileName)
- {
- int c;
- // HOW WE MIGHT WANT TO DO IT:
- char * text = before.line.text;
- for(c = before.x-1; c>= 0; c--)
- if(!isspace(text[c]))
- break;
- ide.debugger.MoveIcons(fileName, before.y + (((!pasteOperation && c > -1) || !after.line.count) ? 1 : 0), after.y - before.y, false);
-
- // HOW VISUAL STUDIO DOES IT:
- /*
- char * text = after.line.text;
- for(c = after.line.count-1; c>= 0; c--)
- if(!isspace(text[c]))
- break;
- ide.debugger.MoveIcons(fileName, before.y + ((c < 0) ? 1 : 0), after.y - before.y, false);
- */
+ int c;
+ // HOW WE MIGHT WANT TO DO IT:
+ const char * text = before.line.text;
+ for(c = Min(before.line.count, before.x-1); c>= 0; c--)
+ if(!isspace(text[c]))
+ break;
+ ide.debugger.MoveIcons(fileName, before.y + (((!pasteOperation && c > -1) || !after.line.count) ? 1 : 0), after.y - before.y, false);
- Update(null);
- }
+ // HOW VISUAL STUDIO DOES IT:
+ /*
+ char * text = after.line.text;
+ for(c = after.line.count-1; c>= 0; c--)
+ if(!isspace(text[c]))
+ break;
+ ide.debugger.MoveIcons(fileName, before.y + ((c < 0) ? 1 : 0), after.y - before.y, false);
+ */
}
+ Update({ 0, 0, editBox.position.x, clientSize.h });
+ UpdateMarginSize();
+ }
+
+ if(!updatingCode)
+ {
+ ObjectInfo oClass;
for(oClass = classes.first; oClass; oClass = oClass.next)
{
hide = true;
else
{
- char * buffer = membersLine.text;
+ const char * buffer = membersLine.text;
int c;
bool firstChar = true;
bool addedChar = false;
membersLoc.end.charPos += after.x - Max(membersLoc.start.charPos, before.x);
- for(c = membersLoc.start.charPos; c<membersLoc.end.charPos; c++)
+ for(c = membersLoc.start.charPos; c<membersLoc.end.charPos && len < sizeof(string)-1; c++)
{
bool isSpace = (buffer[c] == ' ' || buffer[c] == '\t');
if(!isalnum(buffer[c]) && buffer[c] != '_' && (!isSpace || !firstChar)) //|| membersList.currentRow
hide = true;
break;
}
- if(!isSpace)
+ if(!isSpace)
firstChar = false;
else if(firstChar)
{
// Accept current string if hiding typing char
if(hide && row && row.selected)
{
- char * string = row.string;
+ const char * string = row.string;
int len = strlen(string);
membersLoc.end.charPos -= after.x - before.x;
editBox.GoToPosition(membersLine, membersLoc.start.line, membersLoc.start.charPos);
if(/*after.x - before.x == 1 && */after.y == before.y && !membersListShown)
{
EditLine line = editBox.line;
- char * text = line.text;
+ const char * text = line.text;
char ch = text[after.x-1];
if(ch == '.' || (ch == '>' && after.x-1 > 0 && text[after.x-1-1] == '-') || (ch == ':' && after.x-1 > 0 && text[after.x-1-1] == ':'))
{
editBox.GetCaretPosition(&caret);
-
+
// Go back in the buffer until no space before
//yydebug = true;
codeModified = true;
EnsureUpToDate();
SetYydebug(false);
- {
+ {
EditBoxStream f { editBox = editBox };
oldCharPos = x1;
x1--;
membersList.position = { x, y };
}
-
+
membersLine = l1;
membersLoc.start.line = line - 1;
membersLoc.start.charPos = oldCharPos;
}
else if(ch == ')' || ch == '}' || ch == ';')
{
- codeModified = true;
+ codeModified = true;
skipModified = true;
if(paramsShown)
InvokeParameters(false, true, false);
skipModified = false;
}
- else
+ else
{
bool back = codeModified;
codeModified = false;
bool NotifyCharsDeleted(EditBox editBox, BufferLocation before, BufferLocation after, bool pasteOperation)
{
+ if(!loadingFile && after.y != before.y)
+ {
+ ProjectView projectView = ide.projectView;
+ if(projectView && fileName)
+ ide.debugger.MoveIcons(fileName, before.y + 1, before.y - after.y, before.x == 0);
+ Update({ 0, 0, editBox.position.x, clientSize.h });
+ UpdateMarginSize();
+ }
+
if(!updatingCode)
{
ObjectInfo oClass;
- if(after.y != before.y)
- {
- ProjectView projectView = ide.projectView;
- if(projectView && fileName)
- {
- ide.debugger.MoveIcons(fileName, before.y + 1, before.y - after.y, before.x == 0);
- Update(null);
- }
- }
-
for(oClass = classes.first; oClass; oClass = oClass.next)
{
ObjectInfo object;
{
loc = &object.instCode.loc;
- if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
+ if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
(after.y+1 > loc->end.line || (after.y+1 == loc->end.line && after.x+1 >= loc->end.charPos)))
{
object.instCode = null;
if(oClass.classDefinition)
{
loc = &oClass.classDefinition.loc;
- if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
+ if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
(after.y+1 > loc->end.line || (after.y+1 == loc->end.line && after.x+1 >= loc->end.charPos)))
{
oClass.classDefinition = null;
hide = true;
else
{
- char * buffer = membersLine.text;
+ const char * buffer = membersLine.text;
int c;
bool firstChar = true;
char string[1024];
if(before.x >= membersLoc.start.charPos)
{
- for(c = membersLoc.start.charPos; c<before.x; c++)
+ for(c = membersLoc.start.charPos; c<before.x && len < sizeof(string)-1; c++)
{
bool isSpace = (buffer[c] == ' ' || buffer[c] == '\t');
if(!isalnum(buffer[c]) && buffer[c] != '_' && (!isSpace || !firstChar))
if(membersLoc.end.charPos >= after.x)
{
- for(c = after.x; c<membersLoc.end.charPos; c++)
+ for(c = after.x; c<membersLoc.end.charPos && len < sizeof(string)-1; c++)
{
bool isSpace = (buffer[c] == ' ' || buffer[c] == '\t');
if(!isalnum(buffer[c]) && buffer[c] != '_' && (!isSpace || !firstChar))
ObjectInfo object;
ObjectInfo classObject;
- //editBox.NotifyCaretMove(this, editBox, y, x);
editBox.GoToLineNum(y);
+ x = Min(x, editBox.line.count);
editBox.GoToPosition(editBox.line, y, x);
+ // Note: Uncommented this to drag objects after the member instance on which they are dropped
+ editBox.NotifyCaretMove(this, editBox, y+1, x+1);
classObject = selected ? selected.oClass : null;
designer.DroppedObject(control, object, false, classObject.instance);
sheet.AddObject(object, object.name, typeData /* className*/, true);
-
+
UpdateFormCode();
//codeModified = true;
EnsureUpToDate();
bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
{
- if(key == Key { space, ctrl = true })
+ if(key == ctrlSpace)
{
membersList.Destroy(0);
membersListShown = false;
{
if(ide.projectView)
{
- ProjectNode node = ide.projectView.GetNodeFromWindow(this, null);
+ ProjectNode node = ide.projectView.GetNodeForCompilationFromWindow(this, false, null, null);
if(!node)
{
char * s;
- s = PrintString("The ", fileName, " file is not part of any project.\n",
- "It can't be compiled.");
- MessageBox { type = ok, parent = ide, master = ide, text = "File not in project error", contents = s }.Modal();
+ s = PrintString($"The ", fileName, $" file is not part of any project.\n",
+ $"It can't be compiled.");
+ MessageBox { type = ok, /*parent = ide, */master = ide, text = $"File not in project error", contents = s }.Modal();
delete s;
return false;
}
DataRow row = listBox.currentRow;
if(row)
{
- char * string = row.string;
+ const char * string = row.string;
editBox.GoToPosition(membersLine, membersLoc.start.line, membersLoc.start.charPos);
editBox.Delete(
bool OnKeyDown(Key key, unichar ch)
{
CodeEditor editor = (CodeEditor) master;
- if(key == escape || key == leftAlt || key == rightAlt ||
- (key.ctrl && key.code != left && key.code != right &&
+ if(key == escape || key == leftAlt || key == rightAlt ||
+ (key.ctrl && key.code != left && key.code != right &&
key.code != leftShift && key.code != rightShift && key.code != space))
{
+ bool result = true;
if(editor.paramsShown)
+ {
+ if(key == escape)
+ result = false;
editor.paramsList.Destroy(0);
+ editor.paramsShown = false;
+ }
if(editor.membersListShown)
+ {
+ if(key == escape)
+ result = false;
editor.membersList.Destroy(0);
+ editor.membersListShown = false;
+ }
- editor.paramsShown = false;
FreeType(editor.functionType);
- FreeType(editor.instanceType);
-
editor.functionType = null;
+
+ FreeType(editor.instanceType);
editor.instanceType = null;
+
editor.paramsID = -1;
- editor.membersListShown = false;
- return true;
+ return result;
}
- else
+ else
return editor.editBox.OnKeyDown(key, ch);
return false;
}
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+ /*bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
CodeEditor editor = (CodeEditor)master;
- if(!active)
+ Window rw = previous ? previous.rootWindow : null;
+ if(!active && rw != editor.paramsList)
{
Destroy(0);
editor.membersListShown = false;
}
return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
- }
+ }*/
bool OnKeyHit(Key key, unichar ch)
{
DataRow row = currentRow;
if(row && row.selected)
{
- char * string = row.string;
+ const char * string = row.string;
editor.editBox.GoToPosition(editor.membersLine, editor.membersLoc.start.line, editor.membersLoc.start.charPos);
editor.editBox.Delete(
}
};
- ListBox paramsList
+ Window paramsList
{
- master = this,
+ master = this,
interim = true,
clickThrough = true,
autoCreate = false,
borderStyle = contour,
cursor = null,
background = { 255,255,225 },
-
+
OnKeyDown = membersList.OnKeyDown;
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+ /*bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
CodeEditor editor = (CodeEditor)master;
- if(!active)
+ Window rw = previous ? previous.rootWindow : null;
+ if(!active && previous != editor.editBox && rw != editor.membersList)
{
Destroy(0);
- editor.membersListShown = false;
+ editor.paramsShown = false;
}
- return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
- }
+ return Window::OnActivate(active, previous, goOnWithActivation, direct);
+ }*/
bool OnKeyHit(Key key, unichar ch)
{
display.FontExtent(boldFont, instanceName, strlen(instanceName), &nameW, null);
totalW = functionW + nameW;
surface.TextFont(boldFont);
- }
+ }
surface.WriteText(x, y, string, strlen(string));
x += functionW + spaceW;
surface.WriteText(x, y, "(", 1);
x += parW;
- if(methodType && !methodType.staticMethod)
+ if(methodType && !methodType.staticMethod && methodType.methodClass)
{
int tw = 0, width;
if(id == editor.paramsID)
surface.TextFont(boldFont);
-
+
if(methodType.methodClass)
surface.TextExtent(methodType.methodClass.name, strlen(methodType.methodClass.name), &tw, null);
{
surface.WriteText(x, y, ",", 1);
x += ((id == editor.paramsID) ? commaWB : commaW);
- }
+ }
lineW += width;
id ++;
}
- if(!methodType || methodType.staticMethod || !type.params.first || ((Type)type.params.first).kind != voidType || type.params.count > 1)
+ if(!methodType || (methodType.staticMethod || !methodType.methodClass) || !type.params.first || ((Type)type.params.first).kind != voidType || type.params.count > 1)
{
for(param = type.params.first; param; param = param.next)
{
{
surface.WriteText(x, y, ",", 1);
x += ((id == editor.paramsID) ? commaWB : commaW);
- }
+ }
lineW += width;
display.FontExtent(boldFont, instanceName, strlen(instanceName), &nameW, null);
totalW = functionW + nameW + spaceW;
}
-
+
if(editor.functionType)
{
if(methodType)
paramString[0] = 0;
PrintType(param, paramString, true, true);
display.FontExtent((id == editor.paramsID || param.kind == ellipsisType) ? boldFont : font, paramString, strlen(paramString), &width, null);
- if(param.next)
+ if(param.next)
width += ((id == editor.paramsID) ? commaWB : commaW);
if(!height)
}
};
- Menu fileMenu { menu, "File", f }; // MenuPlacement?
- MenuItem { fileMenu, "Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
- MenuItem { fileMenu, "Save As...", a, NotifySelect = MenuFileSaveAs };
+ Menu fileMenu { menu, $"File", f };
+ MenuItem { fileMenu, $"Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
+ MenuItem { fileMenu, $"Save As...", a, NotifySelect = MenuFileSaveAs };
- Menu debugMenu { menu, "Debug", d }; // MenuPlacement?
- MenuItem debugRunToCursor
+ Menu editMenu { menu, $"Edit", e };
+ MenuDivider { editMenu };
+ MenuItem clearTrailingSpacesItem
{
- debugMenu, "Run To Cursor", c, Key { f10, ctrl = true };
+ editMenu, $"Clear trailing spaces", t, Key { t, ctrl = true, shift = true };
+
bool NotifySelect(MenuItem selection, Modifiers mods)
{
- ProjectView projectView = ide.projectView;
- if(!projectView.buildInProgress)
+ // Nuke trailing spaces
+ EditLine line;
+ int y = 0;
+ editBox.recordUndoEvent = true;
+ for(line = editBox.firstLine; line; line = line.next, y++)
{
- int line = editBox.lineNumber + 1;
- if(projectView)
- ide.debugger.RunToCursor(fileName, line, false);
+ const String buffer = line.text;
+ int count = line.count, i = count-1;
+ while(i >= 0 && isspace(buffer[i])) i--;
+ if(i < count - 1)
+ editBox.Delete(line, y, i + 1, line, y, count);
}
+ editBox.recordUndoEvent = false;
return true;
}
};
- MenuItem debugSkipRunToCursor
+
+ Menu debugMenu { menu, $"Debug", d };
+ MenuItem debugRunToCursor { debugMenu, $"Run To Cursor", c, ctrlF10, id = RTCMenuBits { false, false, false }, NotifySelect = RTCMenu_NotifySelect; };
+ MenuItem debugSkipRunToCursor { debugMenu, $"Run To Cursor Skipping Breakpoints", u, Key { f10, ctrl = true, shift = true }, id = RTCMenuBits { true, false, false }, NotifySelect = RTCMenu_NotifySelect; };
+ MenuItem debugRunToCursorAtSameLevel { debugMenu, $"Run To Cursor At Same Level", l, altF10, id = RTCMenuBits { false, true, false }, NotifySelect = RTCMenu_NotifySelect; };
+ MenuItem debugSkipRunToCursorAtSameLevel { debugMenu, $"Run To Cursor At Same Level Skipping Breakpoints", g, Key { f10, shift = true, alt = true }, id = RTCMenuBits { true, true, false }, NotifySelect = RTCMenu_NotifySelect; };
+#if 0
+ MenuItem debugBpRunToCursor { debugMenu, $"BP Run To Cursor"/*, c, ctrlF10*/, id = RTCMenuBits { false, false, true }, NotifySelect = RTCMenu_NotifySelect; };
+ MenuItem debugBpSkipRunToCursor { debugMenu, $"BP Run To Cursor Skipping Breakpoints"/*, u, Key { f10, ctrl = true, shift = true }*/, id = RTCMenuBits { true, false, true }, NotifySelect = RTCMenu_NotifySelect; };
+ MenuItem debugBpRunToCursorAtSameLevel { debugMenu, $"BP Run To Cursor At Same Level"/*, l, altF10*/, id = RTCMenuBits { false, true, true }, NotifySelect = RTCMenu_NotifySelect; };
+ MenuItem debugBpSkipRunToCursorAtSameLevel { debugMenu, $"BP Run To Cursor At Same Level Skipping Breakpoints"/*, g, Key { f10, shift = true, alt = true }*/, id = RTCMenuBits { true, true, true }, NotifySelect = RTCMenu_NotifySelect; };
+#endif
+ bool RTCMenu_NotifySelect(MenuItem selection, Modifiers mods)
{
- debugMenu, "Run To Cursor Skipping Breakpoints", u, Key { f10, ctrl = true, shift = true };
- bool NotifySelect(MenuItem selection, Modifiers mods)
+ ProjectView projectView = ide.projectView;
+ if(!projectView.buildInProgress)
{
- ProjectView projectView = ide.projectView;
+ RTCMenuBits bits = (RTCMenuBits)selection.id;
int line = editBox.lineNumber + 1;
if(projectView)
- ide.debugger.RunToCursor(fileName, line, true);
- return true;
+ {
+ CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+ ProjectConfig config = projectView.project.config;
+ int bitDepth = ide.workspace.bitDepth;
+ bool useValgrind = ide.workspace.useValgrind;
+ ide.debugger.RunToCursor(compiler, config, bitDepth, useValgrind, fileName, line, bits.ignoreBreakpoints, bits.atSameLevel, bits.oldImplementation);
+ delete compiler;
+ }
}
- };
+ return true;
+ }
MenuDivider { debugMenu };
MenuItem debugToggleBreakpoint
{
- debugMenu, "Toggle Breakpoint", t, f9;
+ debugMenu, $"Toggle Breakpoint", t, f9;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
ProjectView projectView = ide.projectView;
if(projectView && fileName)
{
int line = editBox.lineNumber + 1;
- char name[MAX_LOCATION];
- Project prj = null;
- // TOFIX: This only looks at the filename...
- GetLastDirectory(fileName, name);
- if(ide && ide.workspace)
- {
- for(p : ide.workspace.projects)
- {
- if(p.topNode.Find(name, false))
- {
- prj = p;
- break;
- }
- }
- if(!prj)
- {
- for(p : ide.workspace.projects)
- {
- if(eString_PathInsideOf(fileName, p.topNode.path))
- {
- prj = p;
- break;
- }
- }
- }
- }
- ide.debugger.ToggleBreakpoint(fileName, line, prj);
+ ide.debugger.ToggleBreakpoint(fileName, line);
Update(null);
}
return true;
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;
}
{
if(ide.workspace && fileName)
ide.workspace.UpdateOpenedFileInfo(fileName, closed);
-
if(inUseDebug && !debugClosing)
{
debugClosing = true;
if(CloseConfirmation(false))
{
visible = false;
- OnFileModified({ modified = true }, null);
+ if(modifiedDocument)
+ OnFileModified({ modified = true }, null);
}
debugClosing = false;
return false;
//formEditor.Destroy(0);
}*/
}
+ ide.AdjustFileMenus();
}
return true;
}
for(oClass = (classes).first, next = oClass ? oClass.next : null; oClass; oClass = next, next = next ? (next.next) : null)
{
ObjectInfo object, next;
-
+
for(object = oClass.instances.first; object; object = next)
{
next = object.next;
Designer::DestroyObject(object.instance);
delete object.instance;
}
+ if(object.i18nStrings)
+ {
+ Map<String, bool> i18nStrings = object.i18nStrings;
+ delete i18nStrings;
+ }
sheet.DeleteObject(object);
delete object.name;
oClass.instances.Delete(object);
Designer::DestroyObject(oClass.instance);
delete oClass.instance;
}
+ if(oClass.i18nStrings)
+ {
+ Map<String, bool> i18nStrings = oClass.i18nStrings;
+ delete i18nStrings;
+ }
sheet.DeleteObject(oClass);
delete oClass.name;
classes.Delete(oClass);
ProjectView projectView = ide.projectView;
if(projectView)
{
- ProjectNode node = projectView.GetNodeFromWindow(this, null);
+ ProjectNode node = projectView.GetNodeFromWindow(this, null, true, false, null);
if(node && node.modified)
{
node.modified = false;
*/
if(active && directActivation)
{
+ AdjustDebugMenus();
if(openedFileInfo)
openedFileInfo.Activate();
if(designer)
ProcessCaretMove(editBox, line, charPos);
}
}
+ if(!active)
+ {
+ if(membersListShown)
+ {
+ membersList.Destroy(0);
+ membersListShown = false;
+ }
+ if(paramsShown)
+ {
+ paramsList.Destroy(0);
+ paramsShown = false;
+ FreeType(functionType);
+ FreeType(instanceType);
+
+ functionType = null;
+ instanceType = null;
+ paramsID = -1;
+ }
+ }
return true;
}
- bool OnSaveFile(char * fileName)
+ bool OnSaveFile(const char * fileName)
{
File f;
if(designer)
designer.fileName = fileName;
designer.modifiedDocument = false;
}
+
editBox.Save(f, false);
modifiedDocument = false;
-
- delete(f);
+
+ delete f;
return true;
}
return false;
}
- bool OnFileModified(FileChange fileChange, char * param)
+ bool OnFileModified(FileChange fileChange, const char * param)
{
bool reload = false;
if(visible == false && inUseDebug == true)
- reload = true;
+ ide.debugger.WatchesReleaseCodeEditor();
else
{
char message[2048];
- sprintf(message, "The document %s was modified by another application.\n"
+ sprintf(message, $"The document %s was modified by another application.\n"
"Would you like to reload it and lose your changes?", fileName);
- if(MessageBox { type = yesNo, master = /*parent = */parent, text = "Document has been modified",
+ if(MessageBox { type = yesNo, master = /*parent = */parent, text = $"Document has been modified",
contents = message }.Modal() == yes)
reload = true;
}
int lineNumber, charPos, len;
Point scroll;
+ loadingFile = true;
updatingCode = true;
lineNumber = editBox.lineNumber;
charPos = editBox.charPos;
editBox.GoToPosition(editBox.line, lineNumber, charPos <= len ? charPos - 1 : (len ? len - 1 : 0));
editBox.scroll = scroll;
updatingCode = false;
+ loadingFile = false;
codeModified = true;
if(designer)
}
modifiedDocument = false;
- delete(f);
+ delete f;
}
}
return true;
{
int currentLineNumber;
int i;
+ char lineFormat[16];
char lineText[256];
int spaceH;
surface.font = font.font;
surface.TextExtent(" ", 1, null, &spaceH);
currentLineNumber = editBox.scroll.y / spaceH + 1;
+ sprintf(lineFormat, " %%%du", maxLineNumberLength);
surface.SetForeground(lineNumbersColor);
for(i = 0; i < editBox.clientSize.h - 4; i += spaceH)
surface.Area(0, i, editBox.anchor.left.distance, i+spaceH-1);
surface.SetBackground(marginColor);
}
- sprintf(lineText,"%5u ", currentLineNumber % 100000);
+ sprintf(lineText, lineFormat, currentLineNumber);
if(currentLineNumber <= editBox.numLines)
- surface.WriteText(editBox.syntaxHighlighting * 20, i+1,lineText,6);
-
+ surface.WriteText(editBox.syntaxHighlighting * 20, i+1,lineText,maxLineNumberLength+1);
currentLineNumber++;
}
}
if(editBox.syntaxHighlighting && fileName && ide.projectView)
{
- bool error, bpOnCursor, bpOnTopFrame, breakpointEnabled[128];
+ bool error, bpOnTopFrame, breakpointEnabled[128];
int lineCursor, lineTopFrame, breakpointLines[128];
int count, i, lineH, boxH, scrollY; //, firstLine; firstLine = editBox.firstLine;
Debugger debugger = ide.debugger;
scrollY = editBox.scroll.y;
displaySystem.FontExtent(editBox.font.font, " ", 1, null, &lineH);
- bpOnCursor = bpOnTopFrame = false;
+ bpOnTopFrame = false;
count = debugger.GetMarginIconsLineNumbers(fileName, breakpointLines, breakpointEnabled, 128, &error, &lineCursor, &lineTopFrame);
if(count)
{
if(breakpointLines[i] == lineCursor || breakpointLines[i] == lineTopFrame)
{
bmpRes = breakpointEnabled[i] ? ide.bmpBpHalf : ide.bmpBpHalfDisabled;
- if(breakpointLines[i] == lineCursor)
- bpOnCursor = true;
if(breakpointLines[i] == lineTopFrame)
bpOnTopFrame = true;
}
else
bmpRes = breakpointEnabled[i] ? ide.bmpBp : ide.bmpBpDisabled;
-
+
DrawLineMarginIcon(surface, bmpRes, breakpointLines[i], lineH, scrollY, boxH);
}
}
watch(fileName)
{
char ext[MAX_EXTENSION];
- char * fileName = property::fileName;
+ const char * fileName = property::fileName;
if(SearchString(fileName, 0, "Makefile", false, true))
editBox.useTab = true;
if(fileName)
{
GetExtension(fileName, ext);
- if(!strcmpi(ext, "ec"))
- {
- codeModified = true;
- EnsureUpToDate();
- }
- if(!strcmpi(ext, "ec") || !strcmpi(ext, "c") || !strcmpi(ext, "cc") || !strcmpi(ext, "cpp") || !strcmpi(ext, "eh") || !strcmpi(ext, "hh") || !strcmpi(ext, "hpp") || !strcmpi(ext, "h") || !strcmpi(ext, "hxx") || !strcmpi(ext, "cxx"))
+ if(!strcmpi(ext, "ec") || !strcmpi(ext, "eh") || !strcmpi(ext, "c") || !strcmpi(ext, "h") || !strcmpi(ext, "cpp") ||
+ !strcmpi(ext, "hpp") || !strcmpi(ext, "cxx") || !strcmpi(ext, "hxx") || !strcmpi(ext, "cc") || !strcmpi(ext, "hh") ||
+ !strcmpi(ext, "m") || !strcmpi(ext, "mm") || !strcmpi(ext, "cs") || !strcmpi(ext, "java") || !strcmpi(ext, "y") || !strcmpi(ext, "l"))
editBox.syntaxHighlighting = true;
else
editBox.syntaxHighlighting = false;
+
+ if(parsing && !strcmpi(ext, "ec"))
{
- int spaceW;
- display.FontExtent(font.font, " ", 1, &spaceW, null);
- editBox.anchor = Anchor
- {
- left = (editBox.syntaxHighlighting ? 20 : 0) + (ideSettings.showLineNumbers ? (6 * spaceW) : 0),
- right = 0, top = 0, bottom = 0
- };
+ codeModified = true;
+ EnsureUpToDate();
}
+
+ maxLineNumberLength = 0;
+ UpdateMarginSize();
}
};
- bool OnPostCreate()
+ bool UpdateMarginSize()
{
- int spaceW;
- display.FontExtent(font.font, " ", 1, &spaceW, null);
- editBox.anchor = Anchor
+ if(ideSettings.showLineNumbers)
+ {
+ int numLen = Max(4, nofdigits(editBox.numLines));
+ int digitWidth;
+ maxLineNumberLength = numLen;
+ display.FontExtent(font.font, "0", 1, &digitWidth, null);
+ editBox.anchor = Anchor
+ {
+ left = editBox.syntaxHighlighting * 20 + ideSettings.showLineNumbers * (maxLineNumberLength+2) * digitWidth,
+ right = 0, top = 0, bottom = 0
+ };
+ }
+ else
{
- left = (editBox.syntaxHighlighting ? 20 : 0) + (ideSettings.showLineNumbers ? (6 * spaceW) : 0),
- right = 0, top = 0, bottom = 0
- };
+ maxLineNumberLength = 0;
+ editBox.anchor = Anchor
+ {
+ left = editBox.syntaxHighlighting * 20,
+ right = 0, top = 0, bottom = 0
+ };
+ }
+ return true;
+ }
+
+ bool OnPostCreate()
+ {
+ UpdateMarginSize();
return true;
}
- bool LoadFile(char * filePath)
+ bool LoadFile(const char * filePath)
{
File f = FileOpen(filePath, read);
if(f)
{
- // Added this here...
+ // Added this here...
fileName = filePath;
+ loadingFile = true;
updatingCode = true;
editBox.Load(f);
updatingCode = false;
+ loadingFile = false;
Create();
- delete(f);
+ delete f;
return true;
}
return false;
}
- void DebugMenusDisabled()
+ void AdjustDebugMenus()
{
- bool debugMenusDisabled = ide.GetDebugMenusDisabled();
- debugRunToCursor.disabled = debugMenusDisabled;
- debugSkipRunToCursor.disabled = debugMenusDisabled;
- debugToggleBreakpoint.disabled = debugMenusDisabled;
+ bool unavailable = ide.areDebugMenusUnavailable;
+ bool isNotNotRunning = unavailable || ide.isDebuggerRunning;
+ bool isNotStopped = unavailable || !ide.isDebuggerStopped;
+ bool noBreakpointToggle = ide.isBreakpointTogglingUnavailable;
+
+ debugRunToCursor.disabled = isNotNotRunning;
+ debugSkipRunToCursor.disabled = isNotNotRunning;
+ debugRunToCursorAtSameLevel.disabled = isNotStopped;
+ debugSkipRunToCursorAtSameLevel.disabled = isNotStopped;
+#if 0
+ debugBpRunToCursor.disabled = isNotNotRunning;
+ debugBpSkipRunToCursor.disabled = isNotNotRunning;
+ debugBpRunToCursorAtSameLevel.disabled = isNotStopped;
+ debugBpSkipRunToCursorAtSameLevel.disabled = isNotStopped;
+#endif
+ debugToggleBreakpoint.disabled = noBreakpointToggle;
}
CodeEditor()
{
CodeObjectType c;
- ProjectView projectView = ide.projectView;
+
+ globalData.classes.CompareKey = (void *)BinaryTree::CompareString;
+ globalData.defines.CompareKey = (void *)BinaryTree::CompareString;
+ globalData.functions.CompareKey = (void *)BinaryTree::CompareString;
+ globalData.nameSpaces.CompareKey = (void *)BinaryTree::CompareString;
/*if(fileName)
designer.fileName = fileName;
if(designer)
{
char title[1024];
- sprintf(title, "Untitled %d", documentID);
+ sprintf(title, $"Untitled %d", documentID);
// designer.fileName = CopyString(title);
designer.fileName = title;
}
- DebugMenusDisabled();
+ AdjustDebugMenus();
for(c = 0; c < CodeObjectType::enumSize; c++)
icons[c] = BitmapResource { iconNames[c], window = this };
****************************************************************************/
void FreeParser()
{
- this.defines.Free(FreeModuleDefine);
- this.imports.Free(FreeModuleImport);
-
+ SetCurrentNameSpace(null);
if(ast != null)
{
FreeASTTree(ast);
ast = null;
}
+ this.defines.Free(FreeModuleDefine);
+ this.imports.Free(FreeModuleImport); // Moved this after FreeAST because Debug printing causes ModuleImports to be created
+
FreeExcludedSymbols(this.excludedSymbols);
FreeContext(this.globalContext);
+ FreeIncludeFiles();
+ FreeGlobalData(&this.globalData);
+ FindCtx_Terminate();
+ FindParams_Terminate();
if(GetGlobalContext() == globalContext)
{
Designer backDesigner;
char oldWorkDir[MAX_LOCATION];
char mainModuleName[MAX_FILENAME] = "";
- char * fileName;
+ const char * fileName;
ImportedModule module;
char extension[MAX_EXTENSION];
+ PathBackup pathBackup { };
#ifdef _TIMINGS
Time parseCodeStart = GetTime();
Time startTime, startFindClass;
}
}
}
- else
+ else
selectedPos = -1;
}
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- defines.Free(FreeModuleDefine);
- imports.Free(FreeModuleImport);
+ FindCtx_Terminate();
+ FindParams_Terminate();
SetGlobalData(&globalData);
SetGlobalContext(globalContext);
// TOCHECK: COULDN'T WE CALL FreeParser here?
// Clear everything
+ FreeType(this.functionType);
+ FreeType(this.instanceType);
this.functionType = null;
this.instanceType = null;
if(this.oClass)
{
ObjectInfo _class, next;
-
+
for(_class = classes.first; _class; _class = next)
{
ObjectInfo object;
next = _class.next;
-
- for(;object = _class.instances.first;)
+
+ while((object = _class.instances.first))
{
if(object.instance)
{
Designer::DestroyObject(object.instance);
delete object.instance;
}
+ if(object.i18nStrings)
+ {
+ Map<String, bool> i18nStrings = object.i18nStrings;
+ delete i18nStrings;
+ }
sheet.DeleteObject(object);
delete object.name;
_class.instances.Delete(object);
Designer::DestroyObject(_class.instance);
delete _class.instance;
}
+ if(_class.i18nStrings)
+ {
+ Map<String, bool> i18nStrings = _class.i18nStrings;
+ delete i18nStrings;
+ }
sheet.DeleteObject(_class);
delete _class.name;
classes.Delete(_class);
ast = null;
//SetAST(null);
}
+ defines.Free(FreeModuleDefine);
+ imports.Free(FreeModuleImport);
FreeContext(this.globalContext);
FreeExcludedSymbols(this.excludedSymbols);
printf("classes.count: %d\n", globalContext.classes.count);
#endif
- this.privateModule = __ecere_COM_Initialize(false, 1, null);
+ if(ide.workspace)
+ {
+ CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+ SetTargetBits(ide.workspace.bitDepth ? ide.workspace.bitDepth : GetHostBits());
+ delete compiler;
+ }
+ this.privateModule = __ecere_COM_Initialize((bool)(false | ((GetTargetBits() == sizeof(uintptr) *8) ? 0 : GetTargetBits() == 64 ? 2 : 4)), 1, null);
SetPrivateModule(privateModule);
}
if(!project)
project = ide.project;
-
+
GetWorkingDir(oldWorkDir, MAX_LOCATION);
if(project)
ChangeWorkingDir(project.topNode.path);
// TODO: Get symbolsDir from project settings instead...
if(ide.projectView)
{
- DirExpression objDir = project.objDir;
+ CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+ ProjectConfig config = project.config;
+ int bitDepth = ide.workspace.bitDepth;
+ DirExpression objDir = project.GetObjDir(compiler, config, bitDepth);
SetSymbolsDir(objDir.dir);
+ SetDefaultNameSpace(project.GetDefaultNameSpace(config));
+ ide.SetPath(true, compiler, config, bitDepth);
+
delete objDir;
+ delete compiler;
// SetIncludeDirs(ide.projectView.project.config.includeDirs);
// SetSysIncludeDirs(ide.ideSettings.systemDirs[includes]);
}
else
{
- switch(GetRuntimePlatform())
+ switch(__runtimePlatform)
{
case win32: SetSymbolsDir("obj/debug.win32"); break;
case tux: SetSymbolsDir("obj/debug.linux"); break;
case apple: SetSymbolsDir("obj/debug.apple"); break;
- }
+ }
SetIncludeDirs(null);
SetSysIncludeDirs(null);
+ SetDefaultNameSpace(null);
}
{
}
}
}
-
+
if(!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&
strcmpi(mainModuleName, "String.ec") && strcmpi(mainModuleName, "BTNode.ec") &&
strcpy(symLocation, GetSymbolsDir());
PathCat(symLocation, symFile);
-
+
// if(!GetEcereImported() && !GetBuildingEcereCom())
if(!strcmp(extension, "ec") || !strcmp(extension, "eh"))
{
}
}
if(!strcmp(extension, "ec") || !strcmp(extension, "eh"))
+ {
SetDefaultDeclMode(privateAccess);
+ SetDeclMode(privateAccess);
+ }
else
+ {
SetDefaultDeclMode(defaultAccess);
+ SetDeclMode(defaultAccess);
+ }
StripExtension(mainModuleName);
module = ImportedModule { name = CopyString(mainModuleName), type = moduleDefinition };
defines.AddName(module);
#ifdef _DEBUG
- //yydebug = true;
+ // SetYydebug(true);
#endif
resetScanner();
SetIncludeDirs(null);
SetSysIncludeDirs(null);
-
+
delete editFile;
fileInput = null;
SetFileInput(null);
if(GetAST())
{
ast = GetAST();
-
+
#ifdef _TIMINGS
startTime = GetTime();
#endif
if(eClass_GetDesigner(regClass) && !GetBuildingEcereComModule())
{
Instance instance = eInstance_New(regClass);
- ObjectInfo classObject
+ ObjectInfo classObject
{
name = CopyString(_class._class.name);
instance = instance;
classDefinition = _class;
oClass = classObject;
};
- Symbol symbol;
classes.Add(classObject);
incref instance;
propertyClass = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
if(prop.compiled && prop.Set && prop.Get && propertyClass && propDef.initializer && propDef.initializer.type == expInitializer && propDef.initializer.exp)
{
+ Expression computed;
+ bool variable = true;
+
FreeType(propDef.initializer.exp.destType);
propDef.initializer.exp.destType = MkClassType(propertyClass.name);
ProcessExpressionType(propDef.initializer.exp);
-
- if(propertyClass.type == structClass || propertyClass.type == noHeadClass || propertyClass.type == normalClass)
- {
- Expression computed = CopyExpression(propDef.initializer.exp);
- ComputeExpression(computed);
- if(computed.isConstant && computed.type == instanceExp && !id.next)
+ computed = CopyExpression(propDef.initializer.exp);
+ ComputeExpression(computed);
+ if(computed.isConstant)
+ {
+ switch(computed.type)
{
- if(prop.Set)
- {
- if(computed.instance._class && computed.instance._class.symbol &&
- computed.instance._class.symbol.registered &&
- eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+ case stringExp:
+ if(propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
{
- prop.Set(instance, computed.instance.data);
+ String temp = new char[strlen(computed.string)+1];
+ ReadString(temp, computed.string);
+ ((void (*)(void *, void *))(void *)prop.Set)(instance, temp);
+ delete temp;
- // This was saved in the control and shouldn't be freed by FreeExpression...
- if(propertyClass.type == normalClass)
- computed.instance.data = null;
+ if(!propDef.initializer.exp.intlString)
+ {
+ Map<String, bool> i18nStrings = classObject.i18nStrings;
+ if(!i18nStrings)
+ classObject.i18nStrings = i18nStrings = { };
+ i18nStrings[prop.name] = false;
+ }
+ variable = false;
}
- }
- }
- // MOVED THIS UP NOW THAT char * IS A NORMAL CLASS
- else if(computed.type == stringExp)
- {
- char temp[1024];
- ReadString(temp, computed.string);
- prop.Set(instance, temp);
- }
- else
- propDef.variable = true;
-
- FreeExpression(computed);
- }
- else
- {
- Expression computed = CopyExpression(propDef.initializer.exp);
- ComputeExpression(computed);
- if(computed.isConstant)
- {
- //if(computed.type == memberExp) computed = computed.member.exp;
+ break;
+ case instanceExp:
+ if((propertyClass.type == structClass || propertyClass.type == noHeadClass || propertyClass.type == normalClass) && !id.next)
+ {
+ if(prop.Set)
+ {
+ if(computed.instance._class && computed.instance._class.symbol &&
+ computed.instance._class.symbol.registered &&
+ eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+ {
+ ((void (*)(void *, void *))(void *)prop.Set)(instance, computed.instance.data);
- if(computed.type == constantExp)
+ // This was saved in the control and shouldn't be freed by FreeExpression...
+ // (Not doing this anymore, incrementing refCount in pass15 instead)
+ /*if(propertyClass.type == normalClass)
+ computed.instance.data = null;*/
+ }
+ }
+ variable = false;
+ }
+ break;
+ case constantExp:
{
Operand value = GetOperand(computed);
DataValue valueData;
valueData.i64 = value.i64;
SetProperty(prop, instance, valueData);
- }
- else if(computed.type == stringExp)
- {
- char temp[1024];
- ReadString(temp, computed.string);
- prop.Set(instance, temp);
+ variable = false;
+ break;
}
}
- else
- propDef.variable = true;
-
- FreeExpression(computed);
}
+ if(variable)
+ propDef.variable = true;
+ FreeExpression(computed);
}
- else
- propDef.variable = true;
}
else
{
Method method = eClass_FindMethod(regClass, id.string, this.privateModule);
- if(method && method.type == virtualMethod && propDef.initializer && propDef.initializer.type == expInitializer &&
+ if(method && method.type == virtualMethod && propDef.initializer && propDef.initializer.type == expInitializer &&
propDef.initializer.exp && propDef.initializer.exp.type == identifierExp)
{
ClassDef def;
}
}
}
- }
+ }
}
}
}
{
Instance control;
object = object ? object.next : classObject.instances.first;
- control = object.instance;
-
+ control = object.instance;
+
if(inst.members)
{
MembersInit members;
{
curMember = thisMember;
curClass = curMember._class;
- memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
+ memcpy(subMemberStack, _subMemberStack, sizeof(DataMember) * _subMemberStackPos);
subMemberStackPos = _subMemberStackPos;
found = true;
}
{
Property prop = (Property) curMember;
Class propertyClass = prop.dataTypeClass;
+ bool variable = false;
if(!propertyClass)
propertyClass = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
member.initializer.exp.destType = MkClassType(propertyClass.name);
if(propertyClass)
{
+ Expression computed;
+
ProcessExpressionType(member.initializer.exp);
-
- if(propertyClass.type == structClass || propertyClass.type == normalClass || propertyClass.type == noHeadClass)
+
+ computed = CopyExpression(member.initializer.exp);
+ if(computed)
{
- Expression computed = CopyExpression(member.initializer.exp);
- if(computed)
+ bool isClass = propertyClass.type == structClass || propertyClass.type == normalClass || propertyClass.type == noHeadClass;
{
+#ifdef _DEBUG
+ /*char debugExpString[4096];
+ debugExpString[0] = '\0';
+ PrintExpression(member.initializer.exp, debugExpString);*/
+#endif
ComputeExpression(computed);
-
- if(computed.type == instanceExp && computed.isConstant && computed.isConstant)
- {
- if(computed.instance.data)
- {
- if(computed.instance._class && computed.instance._class.symbol &&
- computed.instance._class.symbol.registered &&
- eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
- {
- prop.Set(control, computed.instance.data);
- // This was saved in the control and shouldn't be freed by FreeExpression...
- if(propertyClass.type == normalClass)
- computed.instance.data = null;
- }
- }
- }
- else if(computed.type == identifierExp)
+ switch(computed.type)
{
- member.variable = true;
-
- if(eClass_GetDesigner(propertyClass))
- //if(prop.Set)
- {
- char * name = computed.identifier.string;
- if(!strcmp(name, "this"))
+ case instanceExp:
+ if(isClass && computed.isConstant && computed.instance.data)
{
- if(prop.Set)
- prop.Set(control, instance);
- member.variable = false;
- }
- else
- {
- ObjectInfo check;
- for(check = classObject.instances.first; check; check = check.next)
- if(check.name && !strcmp(name, check.name))
- {
- if(prop.Set)
- prop.Set(control, check.instance);
- member.variable = false;
- break;
- }
+ if(computed.instance._class && computed.instance._class.symbol &&
+ computed.instance._class.symbol.registered &&
+ eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+ {
+ ((void (*)(void *, void *))(void *)prop.Set)(control, computed.instance.data);
+
+ // This was saved in the control and shouldn't be freed by FreeExpression...
+ // (Not doing this anymore, incrementing refCount in pass15 instead)
+ /*if(propertyClass.type == normalClass)
+ computed.instance.data = null;*/
+ }
+ variable = false;
}
- }
- }
- else if(computed.type == memberExp)
- {
- member.variable = true;
- if(computed.member.exp.type == identifierExp)
- {
- char * name = computed.member.exp.identifier.string;
- if(!strcmp(name, "this"))
+ break;
+ case identifierExp:
+ if(isClass && eClass_GetDesigner(propertyClass))
+ //if(prop.Set)
{
- char * name = computed.member.member.string;
+ char * name = computed.identifier.string;
+ if(!strcmp(name, "this"))
+ {
+ if(prop.Set)
+ ((void (*)(void *, void *))(void *)prop.Set)(control, instance);
+ variable = false;
+ }
+ else
{
ObjectInfo check;
for(check = classObject.instances.first; check; check = check.next)
if(check.name && !strcmp(name, check.name))
{
if(prop.Set)
- prop.Set(control, check.instance);
- member.variable = false;
+ ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
+ variable = false;
break;
}
}
}
- else
+ break;
+ case memberExp:
+ if(isClass)
{
- ObjectInfo check;
- for(check = classObject.instances.first; check; check = check.next)
+ if(computed.member.exp.type == identifierExp)
{
- if(check.name && !strcmp(name, check.name))
+ char * name = computed.member.exp.identifier.string;
+ ObjectInfo check;
+ if(!strcmp(name, "this"))
+ {
+ char * name = computed.member.member.string;
+ ObjectInfo check;
+ for(check = classObject.instances.first; check; check = check.next)
+ if(check.name && !strcmp(name, check.name))
+ {
+ if(prop.Set)
+ ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
+ variable = false;
+ break;
+ }
+ }
+ else
{
- Property getProperty = eClass_FindProperty(check.instance._class, computed.member.member.string, this.privateModule);
- if(getProperty)
+ for(check = classObject.instances.first; check; check = check.next)
{
- DataValue value { };
- GetProperty(getProperty, check.instance, &value);
- SetProperty(prop, control, value);
- member.variable = false;
+ if(check.name && !strcmp(name, check.name))
+ {
+ Property getProperty = eClass_FindProperty(check.instance._class, computed.member.member.string, this.privateModule);
+ if(getProperty)
+ {
+ DataValue value { };
+ GetProperty(getProperty, check.instance, &value);
+ SetProperty(prop, control, value);
+ variable = false;
+ }
+ break;
+ }
}
- break;
}
}
}
- }
- }
- // MOVED THIS UP NOW THAT char * IS A NORMAL CLASS
- else if(computed.isConstant && computed.type == stringExp && (propertyClass.dataTypeString && !strcmp(propertyClass.dataTypeString, "char *")))
- {
- char temp[1024];
- ReadString(temp, computed.string);
- prop.Set(control, temp);
- }
- else
- member.variable = true;
+ break;
+ case stringExp:
+ if(propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
+ {
+ String temp = new char[strlen(computed.string)+1];
+ ReadString(temp, computed.string);
+ ((void (*)(void *, void *))(void *)prop.Set)(control, temp);
+ delete temp;
- FreeExpression(computed);
- }
- }
- else
- {
- Expression computed = CopyExpression(member.initializer.exp);
- if(computed)
- {
- ComputeExpression(computed);
- if(computed.isConstant)
- {
- if(computed.type == constantExp && (!propertyClass.dataTypeString || strcmp(propertyClass.dataTypeString, "char *"))) //(strcmp(propertyClass.name, "char *") && (strcmp(propertyClass.name, "String"))))
- {
- if(!strcmp(propertyClass.dataTypeString, "float"))
- ((void (*)(void *, float))(void *)prop.Set)(control, (float)strtod(computed.constant, null));
- else if(!strcmp(propertyClass.dataTypeString, "double"))
- ((void (*)(void *, double))(void *)prop.Set)(control, strtod(computed.constant, null));
- else
- prop.Set(control, strtol(computed.constant, null, 0));
- }
- else if(computed.type == stringExp && (propertyClass.dataTypeString && !strcmp(propertyClass.dataTypeString, "char *"))) // || (!strcmp(propertyClass.name, "String"))))
- {
- char temp[1024];
- ReadString(temp, computed.string);
- prop.Set(control, temp);
- }
- }
- else
- member.variable = true;
+ if(!member.initializer.exp.intlString)
+ {
+ Map<String, bool> i18nStrings = object.i18nStrings;
+ if(!i18nStrings)
+ object.i18nStrings = i18nStrings = { };
+ i18nStrings[prop.name] = false;
+ }
- FreeExpression(computed);
+ variable = false;
+ }
+ break;
+ case constantExp:
+ if(!isClass && computed.isConstant)
+ {
+ if(!strcmp(propertyClass.dataTypeString, "float"))
+ ((void (*)(void *, float))(void *)prop.Set)(control, (float)strtod(computed.constant, null));
+ else if(!strcmp(propertyClass.dataTypeString, "double"))
+ ((void (*)(void *, double))(void *)prop.Set)(control, strtod(computed.constant, null));
+ else
+ ((void (*)(void *, int))(void *)prop.Set)(control, strtol(computed.constant, null, 0));
+ variable = false;
+ }
+ break;
+ }
}
}
+ FreeExpression(computed);
}
}
- else
+ if(variable)
member.variable = true;
}
- else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
+ else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
member.initializer.exp.type == memberExp) // identifierExp
{
Method method = eClass_FindMethod(instClass, ident.string, this.privateModule);
break;
}
}
- }
+ }
}
designer.PostCreateObject(object.instance, object, false, classObject.instance);
if(selectedName)
{
ObjectInfo check;
- int pos = 0;
-
+
for(check = this.oClass.instances.first; check; check = check.next)
{
if(check.name && !strcmp(check.name, selectedName))
printf("Total MkExternalImport time is %.3f seconds\n\n", externalImportTotalTime);
printf("Total FindSymbol time is %.3f seconds\n\n", findSymbolTotalTime);
// printf("Total Class Members Find time is %.3f seconds\n\n", GetClassFindTime());
-
+
printf("Whole ParseCode function took %.3f seconds\n\n", GetTime() - parseCodeStart);
#endif
if(inUseDebug && ide.projectView)
ide.debugger.EvaluateWatches();
+
+ delete pathBackup;
}
void UpdateInstanceCodeClass(Class _class, ObjectInfo object, EditBoxStream f, Instance test, bool * prev, bool * lastIsMethod, DataMember * curMember, Class * curClass)
if(prop && prop.isProperty && !prop.conversion && eClass_FindProperty(object.instance._class, prop.name, privateModule))
{
if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(object, prop.name) &&
- (!prop.IsSet || prop.IsSet(control)))
+ prop.compiled && (!prop.IsSet || prop.IsSet(control)))
{
Class dataType = prop.dataTypeClass;
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
-
+
if(dataType)
{
if(dataType.type == structClass)
{
void * dataForm = new0 byte[dataType.structSize];
void * dataTest = new0 byte[dataType.structSize];
-
- ((void (*)())(void *)prop.Get)(control, dataForm);
- prop.Get(test, dataTest);
-
- if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+
+ ((void (*)(void *, void *))(void *)prop.Get)(control, dataForm);
+ ((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
+
+ if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
char tempString[1024] = "";
- char * string = "";
+ const char * string = "";
bool needClass = true;
if(*prev)
f.Printf(", ");
-
- prop.Set(test, dataForm);
-
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
-
+
+ ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
+
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
+
eClass_FindNextMember(_class, curClass, curMember, null, null);
if(*curMember != (DataMember)prop)
f.Printf("%s = ", prop.name);
else if(dataType.type == normalClass || dataType.type == noHeadClass)
{
void * dataForm, * dataTest;
-
- dataForm = (void *)prop.Get(control);
- dataTest = (void *)prop.Get(test);
-
- if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+ bool isEditBoxContents = false;
+ bool freeDataForm = false, freeDataTest = false;
+
+ // Because contents property is broken for mutiline EditBox at the moment
+ if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox"))
+ isEditBoxContents = true;
+
+ if(isEditBoxContents && ((EditBox)control).multiLine)
+ {
+ dataForm = ((EditBox)control).multiLineContents;
+ freeDataForm = true;
+ }
+ else
+ dataForm = ((void *(*)(void *))(void *)prop.Get)(control);
+ if(isEditBoxContents && ((EditBox)test).multiLine)
+ {
+ dataTest = ((EditBox)test).multiLineContents;
+ freeDataTest = true;
+ }
+ else
+ dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+
+ if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
char tempString[1024] = "";
- char * string = "";
+ const char * string = "";
if(*prev)
f.Printf(", ");
-
- prop.Set(test, dataForm);
-
+
+ ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
+
eClass_FindNextMember(_class, curClass, curMember, null, null);
if(*curMember != (DataMember)prop)
f.Printf("%s = ", prop.name);
if(!object)
{
bool needClass = true;
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
f.Printf("%s", string);
}
}
else
{
bool needClass = true;
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
if(!strcmp(dataType.dataTypeString, "char *"))
{
- f.Printf("\"");
+ Map<String, bool> i18nStrings = object.i18nStrings;
+ bool i18n = true;
+ if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false, null))
+ i18n = false;
+
+ f.Printf("%s\"", i18n ? "$" : "");
OutputString(f, string);
f.Puts("\"");
}
*prev = true;
*lastIsMethod = false;
}
+
+ if(freeDataForm) delete dataForm;
+ if(freeDataTest) delete dataTest;
}
else
{
DataValue dataForm, dataTest;
-
+
GetProperty(prop, control, &dataForm);
GetProperty(prop, test, &dataTest);
-
- if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+
+ if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
{
- char * string;
+ char * string = null;
char tempString[1024] = "";
SetProperty(prop, test, dataForm);
-
+
if(dataType.type != bitClass)
{
bool needClass = true;
if(dataType.type == enumClass)
{
- NamedLink value;
+ NamedLink64 value;
Class enumClass = eSystem_FindClass(privateModule, "enum");
EnumClassData e = ACCESS_CLASSDATA(dataType, enumClass);
+ int64 i64Value = GetI64EnumValue(dataType, dataForm);
for(value = e.values.first; value; value = value.next)
{
- if((int)value.data == dataForm.i)
+ if(value.data == i64Value)
{
string = value.name;
break;
}
}
else
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm, tempString, null, &needClass);
-
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
+
if(string && string[0])
{
if(*prev)
*curMember = (DataMember)prop;
*curClass = curMember->_class;
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm.ui, tempString, null, &needClass);
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm.ui, tempString, null, &needClass);
if(needClass)
f.Printf("%c %s %c", /*dataType.name, */OpenBracket, string, CloseBracket);
else
Window control = (Window)object.instance;
bool prev = false;
bool methodPresent = false;
- Class _class;
bool lastIsMethod = true;
- ObjectInfo classObject = object.oClass;
-
+
if(inst)
{
if(object.deleted)
char ch;
f.Seek(pos - position, current);
while(f.Getc(&ch))
- {
+ {
if(isspace(ch))
{
f.Seek(-1, current);
{
int count = 0;
int toDelete = 0;
- int toAdd = 0;
+ //int toAdd = 0;
f.Seek(-1, current);
+ DeleteJunkBefore(f, position, &position);
f.Puts("\n ");
f.Seek(1, current);
//f.Puts("\n");
position--;
if(count > 6)
{
- toDelete += count - 6;
+ toDelete += count - 6;
count = 6;
}
- else
- toAdd = 6 - count;
- break;
+ /*else
+ toAdd = 6 - count;*/
+ break;
}
}
if(toDelete)
f.DeleteBytes(toDelete);
f.Seek(count, current);
}
+
+ DeleteJunkBefore(f, position, &position);
+
+ // Removed this here as it was adding trailing spaces when adding a method
+ /*
if(toAdd)
{
int c;
for(c = 0; c<toAdd; c++)
f.Putc(' ');
}
+ */
}
}
else
methodPresent = multiLine;
- if(!prev)
+ //if(!prev) -- always false
f.Printf(methodPresent ? "\n " : " ");
-
}
}
- else
+ else
{
// Instance not there, create a brand new one
DeleteJunkBefore(f, position, &position);
Class instClass = eSystem_FindClass(this.privateModule, inst._class.name);
DeleteJunkBefore(f, position, &position);
-
+
// Instance already there, clear out the properties
- for(members = inst.members->first; members; members = members.next)
+ for(members = inst.members ? inst.members->first : null; members; members = members.next)
{
if(members.type == dataMembersInit)
{
else
{
Method method = eClass_FindMethod(instClass, ident.string, this.privateModule);
- if(method && method.type == virtualMethod && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
+ if(method && method.type == virtualMethod && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
member.initializer.exp.type == memberExp /*ExpIdentifier*/)
{
if(((this.methodAction == actionDetachMethod || this.methodAction == actionReattachMethod) && this.method == method && this.selected == object) ||
position = member.loc.end.pos;
deleted = true;
}
- }
+ }
}
}
}
//f.Seek(member.loc.start.pos - position, current);
//position = member.loc.start.pos;
DeleteJunkBefore(f, member.loc.start.pos, &position);
- if(prev) f.Printf(", ");
+ if(prev) f.Printf(", ");
else if(keptMember) f.Printf(" ");
prev = false;
}
- }
-
+ }
+
if(!keptMember || !members.next)
{
char ch = 0;
- int count = 0;
if(keptMember && lastKept != members.dataMembers->last)
{
f.Seek(members.loc.end.pos - position, current);
f.Getc(&ch);
-
+
if(ch == ';')
{
f.Seek(-1, current);
*/
prev = true;
lastIsMethod = false;
-
+
}
}
else
methodPresent = true;
// Delete instance method here
- if((this.methodAction == actionDeleteMethod || (this.methodAction == actionDetachMethod && this.moveAttached)) &&
+ if((this.methodAction == actionDeleteMethod || (this.methodAction == actionDetachMethod && this.moveAttached)) &&
members.function == function)
{
if(this.moveAttached && !*text)
DeleteJunkBefore(f, members.loc.start.pos, &position);
lastIsMethod = true;
- f.Printf("\n\n ");
+ f.Printf("\n\n ");
}
f.Seek(members.loc.end.pos - position, current);
memmove(*text + movedFuncIdPos + newLen, *text + movedFuncIdPos + movedFuncIdLen, *textSize - movedFuncIdPos - movedFuncIdLen + 1);
*textSize += newLen - movedFuncIdLen;
memcpy(*text + movedFuncIdPos, method.name, newLen);
-
+
// Second, tab right
{
int c;
// ADDING METHOD HERE
f.Printf("\n ");
OutputType(f, returnType, false);
-
+
f.Printf(" ");
if(dataType.thisClass)
{
if(param.next)
f.Printf(", ");
}
- f.Printf(")\n");
+ f.Printf(")\n");
f.Printf(" %c\n\n", OpenBracket);
if(control._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
for(param = dataType.params.first; param; param = param.next)
{
if(param.prev) f.Printf(", ");
- f.Printf(param.name);
+ if(param.kind != voidType)
+ f.Printf(param.name);
}
f.Printf(");\n");
}
}
if(!object.instCode)
- {
- if(methodPresent)
- f.Printf(" %c;\n", CloseBracket);
- else
- f.Printf("%c;\n", CloseBracket);
- }
+ f.Printf(methodPresent ? " %c;" : "%c;", CloseBracket);
else if(!object.deleted)
{
// Turn this into a multiline instance when adding a method
{
Property propIt;
Class regClass = eSystem_FindClass(privateModule, classObject.name);
-
+
if(_class.base && _class.base.type != systemClass) OutputClassProperties(_class.base, classObject, f, test);
-
+
for(propIt = _class.membersAndProperties.first; propIt; propIt = propIt.next)
{
Property prop = eClass_FindProperty(selected.instance._class, propIt.name, privateModule);
if(prop && prop.isProperty && !prop.conversion)
{
- if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(classObject, prop.name) &&
+ if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(classObject, prop.name) &&
(!prop.IsSet || prop.IsSet(classObject.instance)))
{
Class dataType = prop.dataTypeClass;
char tempString[1024] = "";
- char * string;
+ char * string = null;
bool specify = false;
DataMember member;
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
-
+
if(dataType && dataType.type == structClass)
{
void * dataForm = new0 byte[dataType.structSize];
void * dataTest = new0 byte[dataType.structSize];
-
- prop.Get(classObject.instance, dataForm);
- prop.Get(test, dataTest);
- if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+ ((void (*)(void *, void *))(void *)prop.Get)(classObject.instance, dataForm);
+ ((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
+
+ if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
bool needClass = true;
-
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
- prop.Set(test, dataForm);
+
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
+ ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
if(needClass)
f.Printf("\n %s%s = %c %s %c;", specify ? "property::" : "", prop.name, /*dataType.name, */OpenBracket, string, CloseBracket);
else
else if(dataType && (dataType.type == normalClass || dataType.type == noHeadClass))
{
void * dataForm, * dataTest;
-
- dataForm = (void *)prop.Get(classObject.instance);
- dataTest = (void *)prop.Get(test);
-
- if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+ bool isEditBoxContents = false;
+ bool freeDataForm = false, freeDataTest = false;
+
+ // Because contents property is broken for mutiline EditBox at the moment
+ if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox"))
+ isEditBoxContents = true;
+
+ if(isEditBoxContents && ((EditBox)classObject.instance).multiLine)
+ {
+ dataForm = ((EditBox)classObject.instance).multiLineContents;
+ freeDataForm = true;
+ }
+ else
+ dataForm = ((void *(*)(void *))(void *)prop.Get)(classObject.instance);
+ if(isEditBoxContents && ((EditBox)test).multiLine)
+ {
+ dataTest = ((EditBox)test).multiLineContents;
+ freeDataTest = true;
+ }
+ else
+ dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+
+ if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
char tempString[1024] = "";
- char * string;
- prop.Set(test, dataForm);
-
+ char * string = null;
+ ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
+
if(eClass_IsDerived(classObject.instance._class, dataType) && classObject.instance == dataForm)
{
// Shouldn't go here ...
{
bool needClass = true;
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
if(!strcmp(dataType.dataTypeString, "char *"))
{
- f.Printf("\n %s%s = \"", specify ? "property::" : "", prop.name);
+ Map<String, bool> i18nStrings = classObject.i18nStrings;
+ bool i18n = true;
+ if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false, null))
+ i18n = false;
+
+ f.Printf("\n %s%s = %s\"", specify ? "property::" : "", prop.name, i18n ? "$" : "");
OutputString(f, string);
f.Puts("\";");
}
f.Printf("\n %s%s = %s;", specify ? "property::" : "", prop.name, string);
}
}
+ if(freeDataForm) delete dataForm;
+ if(freeDataTest) delete dataTest;
}
else if(dataType)
{
DataValue dataForm, dataTest;
-
+
GetProperty(prop, classObject.instance, &dataForm);
GetProperty(prop, test, &dataTest);
-
- if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+
+ if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
{
SetProperty(prop, test, dataForm);
if(dataType.type == bitClass)
{
bool needClass = true;
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm, tempString, null, &needClass);
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
if(needClass)
f.Printf("\n %s%s = %c %s %c;", specify ? "property::" : "", prop.name, /*dataType.name, */OpenBracket, string, CloseBracket);
else if(string[0])
bool needClass = true;
if(dataType.type == enumClass)
{
- NamedLink value;
+ NamedLink64 value;
Class enumClass = eSystem_FindClass(privateModule, "enum");
EnumClassData e = ACCESS_CLASSDATA(dataType, enumClass);
+ int64 i64Value = GetI64EnumValue(dataType, dataForm);
for(value = e.values.first; value; value = value.next)
{
- if((int)value.data == dataForm.i)
+ if(value.data == i64Value)
{
string = value.name;
break;
}
}
else
- string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm, tempString, null, &needClass);
+ string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
if(!strcmp(dataType.dataTypeString, "float") && strchr(string, '.'))
f.Printf("\n %s%s = %sf;", specify ? "property::" : "", prop.name, string);
else if(string[0])
f.Printf("\n %s%s = %s;", specify ? "property::" : "", prop.name, string);
}
- }
+ }
}
}
}
void UpdateFormCode()
{
if(!this) return;
-
+ if(!parsing) return;
+
updatingCode++;
if(codeModified)
{
int position = 0;
char * text = null;
int textSize;
- Identifier movedFuncId;
+ Identifier movedFuncId;
int movedFuncIdLen = 0, movedFuncIdPos = 0;
ObjectInfo classObject;
updatingCode++;
+ editBox.recordUndoEvent = true;
+
if(moveAttached)
{
movedFuncId = GetDeclId(function.declarator);
for(classObject = classes.first; classObject; classObject = classObject.next)
{
- Class _class;
ClassDefinition classDef = classObject.classDefinition;
Class regClass = eSystem_FindClass(this.privateModule, ((Specifier)classDef.baseSpecs->first).name);
Instance test;
// Put it in the same desktop window...
designer.PrepareTestObject(test);
-
+
//f.Printf("class %s : %s\n", classObject.name, classObject.oClass.name);
//f.Printf("%c\n\n", OpenBracket);
int back = 0;
f.Seek(classDef.blockStart.end.pos - position, current);
position = classDef.blockStart.end.pos;
-
+
for(; f.Getc(&ch); count++)
{
if(!isspace(ch))
f.Seek(-1, current);
break;
}
-
+
if(ch == '\n')
back = 0;
else
back++;
}
-
+
f.Seek(-count, current);
-
+
f.DeleteBytes(count-back);
//f.Printf("\n");
position += count-back;
bool keptMember = false;
MemberInit propDef;
MemberInit lastKept = null;
-
+
lastIsDecl = false;
DeleteJunkBefore(f, def.loc.start.pos, &position);
- f.Printf("\n ");
+
+ // This was adding blank spaces between comment and properties -- What was it for?
+ // f.Printf("\n ");
for(propDef = def.defProperties->first; propDef; propDef = propDef.next)
{
position = propDef.loc.end.pos;
deleted = true;
}
- }
+ }
}
}
}
lastKept = propDef;
}
}
-
+
if(!keptMember)
{
char ch = 0;
- int count = 0;
f.Seek(def.loc.end.pos - position - 1, current);
f.Getc(&ch);
-
+
if(ch == ';')
{
f.Seek(-1, current);
{
char ch;
int count = 0;
-
+
f.Seek(-1, current);
for(;f.Getc(&ch);)
{
{
f.Seek(def.loc.end.pos - position, current);
position = def.loc.end.pos;
- }
+ }
}
break;
}
f.Printf("\n\n ");
// Delete _class methods
- if((methodAction == actionDeleteMethod || (moveAttached && selected != classObject)) &&
+ if((methodAction == actionDeleteMethod || (moveAttached && selected != classObject)) &&
def.function == function)
{
char ch;
position = function.loc.start.pos + movedFuncIdPos + movedFuncIdLen;
}
- if((methodAction == actionAttachMethod || methodAction == actionReattachMethod) && selected == classObject && moveAttached &&
+ if((methodAction == actionAttachMethod || methodAction == actionReattachMethod) && selected == classObject && moveAttached &&
function == def.function)
{
// In case of attaching methods in the _class, simply rename the method
firstObject = false;
lastIsDecl = true;
}
- else
+ else
{
f.Printf("\n ");
lastIsDecl = false;
DeleteJunkBefore(f, position, &position);
f.Printf("\n %s = %s;\n", method.name, function.declarator.symbol.string);
}
-
+
// ********** INSTANCES ***************
for(; object; object = object.next)
{
f.Printf("\n\n");
f.Printf(" ");
OutputType(f, returnType, false);
-
+
f.Printf(" ");
if(dataType.thisClass && !dataType.classObjectType)
{
if(param.next)
f.Printf(", ");
}
- f.Printf(")\n");
+ f.Printf(")\n");
f.Printf(" %c\n\n", OpenBracket);
if(test._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
for(param = dataType.params.first; param; param = param.next)
{
if(param.prev) f.Printf(", ");
- if(param.kind != voidType)
+ if(param.kind != voidType)
f.Printf(param.name);
}
f.Printf(");\n");
delete test;
}
+ editBox.recordUndoEvent = false;
+
updatingCode--;
delete f;
method = null;
}
- int FindMethod(char * methodName /*Method method*/, ClassFunction*functionPtr, Location propLoc)
+ int FindMethod(const char * methodName /*Method method*/, ClassFunction*functionPtr, Location propLoc)
{
int found = 0;
ClassFunction function = null;
if(methodName)
{
ObjectInfo object = this.selected;
-
+
if(object && object == this.oClass)
{
ClassDefinition classDef = object.oClass.classDefinition;
return found;
}
- void GoToMethod(char * methodName /*Method method*/)
+ void GoToMethod(const char * methodName /*Method method*/)
{
if(methodName)
{
{
if(!testMethod.dataType)
testMethod.dataType = ProcessTypeString(testMethod.dataTypeString, false);
-
+
//if(CheckCompatibleMethod(method, testMethod.dataType, ®Class, false, selectedClass)) // this.selected == this.oClass, selectedClass))
if(CheckCompatibleMethod(method, testMethod.dataType, this.oClass.instance._class, false, selectedClass)) // this.selected == this.oClass, selectedClass))
//if(CheckCompatibleMethod(method, testMethod.dataType, ®Class, this.selected == this.oClass, FindClass(this.oClass.oClass.name)))
this.method = method;
ModifyCode();
}
- UpdateFormCode();
+ UpdateFormCode();
GoToMethod(methodName);
}
}
methodAction = actionDeleteMethod;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
if(!method || method.type != virtualMethod)
{
char title[1024];
- sprintf(title, "Attach %s", function.declarator.symbol.string);
- if(MessageBox { type = yesNo, master = parent, text = title, contents = "Method is unused. Move method inside instance?"}.Modal() == yes)
+ sprintf(title, $"Attach %s", function.declarator.symbol.string);
+ if(MessageBox { type = yesNo, master = parent, text = title, contents = $"Method is unused. Move method inside instance?"}.Modal() == yes)
{
moveAttached = true;
}
this.method = method;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
}
if(!method || method.type != virtualMethod)
{
char title[1024];
- sprintf(title, "Attach %s", function.declarator.symbol.string);
- if(MessageBox { type = yesNo, master = parent, text = title,
- contents = "Method is unused. Move method inside instance?" }.Modal() == yes)
+ sprintf(title, $"Attach %s", function.declarator.symbol.string);
+ if(MessageBox { type = yesNo, master = parent, text = title,
+ contents = $"Method is unused. Move method inside instance?" }.Modal() == yes)
{
moveAttached = true;
}
this.method = method;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
}
{
Window dialog
{
- hasClose = true, borderStyle = sizable, minClientSize = { 300, 55 },
- master = sheet, text = "Name detached method", background = activeBorder
+ hasClose = true, borderStyle = sizable, minClientSize = { 300, 55 },
+ master = sheet, text = $"Name detached method", background = formColor
};
Button cancelButton
{
- dialog, anchor = { horz = 45, top = 30 }, size = { 80 }, text = "Cancel", hotKey = escape,
+ dialog, anchor = { horz = 45, top = 30 }, size = { 80 }, text = $"Cancel", hotKey = escape,
id = DialogResult::cancel, NotifyClicked = ButtonCloseDialog
};
Button okButton
{
- dialog, anchor = { horz = -45, top = 30 }, size = { 80 }, text = "OK", isDefault = true,
+ dialog, anchor = { horz = -45, top = 30 }, size = { 80 }, text = $"OK", isDefault = true,
id = DialogResult::ok, NotifyClicked = ButtonCloseDialog
};
EditBox nameBox
strcat(name, this.methodName);
strcpy(this.methodName, name);
}
-
+
this.moveAttached = true;
}
this.method = method;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
}
ObjectInfo check;
sprintf(name, "%c%s%d", tolower(instance._class.name[0]), instance._class.name+1, id);
- // if(strcmp(name, this.oClass.instance.name))
-
+ // if(strcmp(name, this.oClass.instance.name))
+
{
for(check = oClass.instances.first; check; check = check.next)
- if(!check.deleted && check.name && !strcmp(name, check.name))
+ if(!check.deleted && check.name && !strcmp(name, check.name))
break;
if(!check)
{
break;
}
}
- }
+ }
toolBox.controlClass = null;
ModifyCode();
void EnsureUpToDate()
{
- if(sheet && codeModified)
+ if(sheet && codeModified && parsing)
ParseCode();
}
for(oClass = classes.first; oClass; oClass = oClass.next)
{
- ObjectInfo object;
+ if(oClass.instance)
+ {
+ ObjectInfo object;
- sheet.AddObject(oClass, oClass.name ? oClass.name : oClass.instance._class.name, typeClass, false);
- for(object = oClass.instances.first; object; object = object.next)
- sheet.AddObject(object, object.name ? object.name : object.instance._class.name, typeData, false);
+ sheet.AddObject(oClass, oClass.name ? oClass.name : oClass.instance._class.name, typeClass, false);
+ for(object = oClass.instances.first; object; object = object.next)
+ sheet.AddObject(object, object.name ? object.name : object.instance._class.name, typeData, false);
+ }
}
sheet.SelectObject(selected);
}
ObjectInfo select = object;
for(;;)
- {
+ {
select = select.prev;
- if(!select)
+ if(!select)
{
if(looped) break;
select = object.oClass.instances.last;
sheet.DeleteObject(object);
}
- void RenameObject(ObjectInfo object, char * name)
+ void RenameObject(ObjectInfo object, const char * name)
{
bool valid = false;
BitmapResource bitmap = null;
if(!subMember.dataType)
subMember.dataType = ProcessTypeString(subMember.dataTypeString, false);
-
+
if(subMember.dataType && subMember.dataType.kind == classType && subMember.dataType._class)
{
- char * bitmapName = (char *)eClass_GetProperty(subMember.dataType._class.registered, "icon");
+ char * bitmapName = (char *)(intptr)eClass_GetProperty(subMember.dataType._class.registered, "icon");
if(bitmapName)
{
bitmap = { bitmapName };
else if(member.name && !membersList.FindString(member.name))
{
DataRow row = membersList.AddString(member.name);
-
+
BitmapResource bitmap = null;
if(!member.dataType)
member.dataType = ProcessTypeString(member.dataTypeString, false);
-
+
if(member.dataType && member.dataType.kind == classType && member.dataType._class)
{
- char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
+ char * bitmapName = (char *)(intptr)eClass_GetProperty(member.dataType._class.registered, "icon");
if(bitmapName)
{
bitmap = { bitmapName };
for(_class = whatClass; _class && _class.type != systemClass; _class = _class.base)
{
Method method;
- Property prop;
- DataMember member;
for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
{
if(!method.dataType)
method.dataType = ProcessTypeString(method.dataTypeString, false);
- if(MatchTypes(method.dataType, methodType, null, whatClass, /*null, */whatClass, false, true, false, false))
+ if(MatchTypes(method.dataType, methodType, null, whatClass, /*null, */whatClass, false, true, false, false, true))
{
DataRow row = membersList.FindString(method.name);
if(!row)
}
}
- void ListClassPropertiesAndVirtual(Class whatClass)
+ void ListClassPropertiesAndVirtual(Class whatClass, const String curString)
{
Class _class;
bool isPrivate = false;
- for(_class = whatClass; _class && _class.type != systemClass; _class = _class.base)
+ for(_class = whatClass; _class /*&& _class.type != systemClass*/; _class = _class.base)
{
Method method;
- Property prop;
DataMember member;
for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
row.icon = icons[(member.memberAccess == publicAccess && !isPrivate) ? typeProperty : typePropertyPrivate];
}
}
- else if(member.name)
+ else if(member.name && (!curString || strcmp(curString, member.name)))
{
DataRow row = membersList.AddString(member.name);
-
+
BitmapResource bitmap = null;
if(!member.dataType)
member.dataType = ProcessTypeString(member.dataTypeString, false);
-
+
if(member.dataType && member.dataType.kind == classType && member.dataType._class)
{
- char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
+ char * bitmapName = (char *)(intptr)eClass_GetProperty(member.dataType._class.registered, "icon");
if(bitmapName)
{
bitmap = { bitmapName };
{
if(type && (type.kind == classType || type.kind == structType || type.kind == unionType))
{
- Class _class;
-
if(type.kind == classType)
{
if(type._class)
for(link = (BTNamedLink)nameSpace.classes.first; link; link = (BTNamedLink)((BTNode)link).next)
{
Class _class = link.data;
- if(_class.type != systemClass)
+ if(_class.type != systemClass && !_class.templateClass) // Omit templatized classes
{
DataRow row = membersList.AddString(_class.name);
row.icon = (_class.type == unitClass || _class.type == enumClass) ? icons[typeDataType] : icons[typeClass];
for(link = (BTNamedLink)nameSpace.defines.first; link; link = (BTNamedLink)((BTNode)link).next )
{
- DefinedExpression definedExp = link.data;
+ //DefinedExpression definedExp = link.data;
DataRow row = membersList.AddString(link /*definedExp*/.name);
row.icon = icons[typeData];
}
for(link = (BTNamedLink)nameSpace.functions.first; link; link = (BTNamedLink)((BTNode)link).next)
{
- GlobalFunction function = link.data;
+ //GlobalFunction function = link.data;
DataRow row = membersList.AddString(link /*function*/.name);
row.icon = icons[typeMethod];
}
void ListEnumValues(Class _class)
{
+ List<Class> classes { };
for(; _class && _class.type == enumClass; _class = _class.base)
+ classes.Insert(null, _class);
+ for(_class : classes)
{
EnumClassData enumeration = (EnumClassData)_class.data;
- NamedLink item;
+ NamedLink64 item;
for(item = enumeration.values.first; item; item = item.next)
{
DataRow row = membersList.AddString(item.name);
row.icon = icons[typeEnumValue];
}
}
+ delete classes;
}
bool ListEnumsModule(Module mainModule, Type dest)
return result;
}
- void ListNameSpaceByString(Module mainModule, char * string)
+ void ListNameSpaceByString(Module mainModule, const char * string)
{
NameSpace * nameSpace;
Module module;
for(link = (BTNamedLink)nameSpace.classes.first; link; link = (BTNamedLink)((BTNode)link).next)
{
Class _class = link.data;
- if(_class.type == enumClass && (dest.kind != classType || !dest._class || dest._class.registered != _class))
+ if(_class.type == enumClass && (dest.kind != classType || ((!dest._class || !dest._class.registered || (dest._class.registered != _class && strcmp(dest._class.registered.dataTypeString, "char *") && strcmp(dest._class.string, "bool"))) && !dest.classObjectType)) &&
+ dest.kind != pointerType && dest.kind != ellipsisType)
{
OldList conversions { };
Type type { };
type.kind = classType;
type._class = FindClass(_class.name);
- if(MatchTypes(type, dest, &conversions, null, null, true, false, false, false))
+ if(MatchTypes(type, dest, &conversions, null, null, true, false, false, false, true))
{
ListEnumValues(_class);
result = true;
return result;
}
- NameSpace * FindNameSpace(NameSpace nameSpace, char * name)
+ NameSpace * FindNameSpace(NameSpace nameSpace, const char * name)
{
int start = 0, c;
char ch;
return (NameSpace *)nameSpace;
}
- void ListSymbols(Expression exp, bool enumOnly, char * string, Identifier realIdentifier)
+ void ListSymbols(Expression exp, bool enumOnly, const char * string, Identifier realIdentifier)
{
bool listedEnums = false;
Type destType = (exp && exp.destType && !exp.destType.truth) ? exp.destType : null;
}
}
- if(this.privateModule && destType && (destType.kind != pointerType || destType.type.kind != voidType) && destType.kind != ellipsisType)
+ if(this.privateModule && destType && (destType.kind == _BoolType || destType.kind == classType || destType.kind == enumType || destType.kind == structType || destType.kind == templateType || destType.kind == thisClassType || destType.kind == unionType ||
+ (destType.kind == pointerType && destType.type.kind != voidType)))
+ //if(this.privateModule && destType && (destType.kind != pointerType || destType.type.kind != voidType) && destType.kind != ellipsisType)
{
listedEnums = ListEnumsModule(this.privateModule, destType);
}
ListEnumValues(destType._class.registered);
if(insideClass)
- ListClassPropertiesAndVirtual(insideClass);
+ ListClassPropertiesAndVirtual(insideClass, null);
listedEnums = true;
}
else if(destType && destType.kind == enumType)
{
- NamedLink value;
+ NamedLink64 value;
for(value = destType.members.first; value; value = value.next)
{
}
if(insideClass)
- ListClassPropertiesAndVirtual(insideClass);
+ ListClassPropertiesAndVirtual(insideClass, null);
listedEnums = true;
}
else if(insideClass && !enumOnly)
{
- ListClassPropertiesAndVirtual(insideClass);
+ ListClassPropertiesAndVirtual(insideClass, string);
}
if(listedEnums && string && string[0])
{
DataRow row = membersList.FindSubString(string);
if(!row)
- listedEnums = false;
+ listedEnums = false;
}
-
+
if(!insideClass && exp && exp.destType && exp.destType.kind == functionType && GetThisClass())
{
ListClassMembersMatch(GetThisClass(), exp.destType);
Symbol symbol = null;
{
if(GetThisClass())
- {
+ {
ListClassMembers(GetThisClass(), false);
}
{
row.icon = icons[typeEnumValue];
}
- else
+ else
{
BitmapResource bitmap = null;
if(symbol.type && symbol.type.kind == classType && symbol.type._class && symbol.type._class)
{
- char * bitmapName = (char *)eClass_GetProperty(symbol.type._class.registered, "icon");
+ char * bitmapName = (char *)(intptr)eClass_GetProperty(symbol.type._class.registered, "icon");
if(bitmapName)
{
bitmap = { bitmapName };
{
row.icon = icons[typeEnumValue];
}
- else
+ else
{
BitmapResource bitmap = null;
if(data.dataType && data.dataType.kind == classType && data.dataType._class && data.dataType._class)
void OverrideVirtualFunction(ClassFunction function, Method method, Class _class, bool isInstance, bool extraIndent)
{
EditBoxStream f { editBox = editBox };
- uint position = 0;
+ int position = 0;
EditLine l1, l2;
int x1,y1,x2,y2;
OutputType(f, returnType, false);
f.Printf(" ");
-
+
if(dataType.thisClass && !dataType.classObjectType && (!isInstance || !insideClass || !eClass_IsDerived(insideClass, dataType.thisClass.registered)))
{
if(dataType.thisClass.shortName)
f.Printf(", ");
}
}
- f.Printf(")\n");
+ f.Printf(")\n");
if(extraIndent) f.Printf(" ");
f.Printf(" %c\n", OpenBracket);
f.Printf("\n");
- //if(test._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
+ if(!_class ||
+ (
+ (isInstance ? _class : _class.base)._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad] ||
+ (isInstance ? _class : _class.base)._vTbl[method.vid] == DummyMethod)) // Temp Check for DefaultFunction
{
if(returnType && returnType.kind == classType && !strcmp(returnType._class.string, "bool"))
{
f.Printf(" return 0;\n");
}
}
- /*else
+ else
{
+ if(extraIndent) f.Printf(" ");
f.Printf(" ");
if(returnType.kind != voidType)
f.Printf("return ");
- f.Printf("%s::%s(this", classDef.base.name, method.name);
+ f.Printf("%s::%s(", isInstance ? _class.name : _class.base.name, method.name);
for(param = dataType.params.first; param; param = param.next)
{
- f.Printf(", ");
- f.Printf(param.name);
+ if(param.prev) f.Printf(", ");
+ if(param.kind != voidType)
+ f.Printf(param.name);
}
f.Printf(");\n");
- }*/
-
+ }
}
if(extraIndent) f.Printf(" ");
{
bool didOverride = false;
EditLine line = editBox.line;
- char * text = line.text;
int lineNum, charPos;
Expression exp = null;
EditLine l1, l2;
Expression memberExp = null;
Identifier realIdentifier = null;
+ if(!parsing) return true;
if(!privateModule) return !didOverride;
insideFunction = null;
}
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- {
+ {
EditBoxStream f { editBox = editBox };
updatingCode = true;
else if(!pointer)
{
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- {
+ {
EditBoxStream f { editBox = editBox };
char ch = 0;
int rowCount;
char tempString[1024];
char * string = null;
- CodePosition idStart, idEnd;
+ CodePosition idStart { };
+ CodePosition idEnd { };
if(membersListShown)
{
- char * buffer = membersLine.text;
+ const char * buffer = membersLine.text;
int c;
bool firstChar = true;
int len = 0;
}
string[len] = 0;
*/
- int x, y;
+ int x = 0, y;
int len = 0;
EditLine editLine = editBox.line;
bool firstChar = true;
string = tempString;
for(y = lineNum-1; y >= 0; y--)
{
- char * buffer = editLine.text;
+ const char * buffer = editLine.text;
int lineCount = editLine.count;
for(x = (y == lineNum-1) ? (Min(charPos, lineCount) - 1 ): lineCount-1; x >= 0; x--)
{
DataRow row = string ? membersList.FindSubString(string) : null;
if(row && !membersList.FindSubStringAfter(row, string) && !caretMove)
{
- char * newString = row.string;
+ const char * newString = row.string;
if(!membersListShown)
{
membersLoc.start.line = idStart.line-1;
editBox.SetSelPos(l1, y1, idStart.charPos-1, l2, y2, idStart.charPos-1);
editBox.GetCaretPosition(caret);
editBox.SetSelPos(l1, y1, x1, l2, y2, x2);
-
+
membersList.master = this;
caret.y += editBox.GetCaretSize();
}
if(row)
membersList.SetScrollPosition(0, row.index * membersList.rowHeight);
- }
+ }
}
}
}
void InvokeParameters(bool exact, bool reposition, bool caretMove)
{
- EditLine line = editBox.line;
- char * text = line.text;
int lineNum, charPos;
- Expression exp = null;
EditLine l1, l2;
int x1,y1, x2,y2;
+ if(!parsing) return;
+
charPos = editBox.charPos + 1;
EnsureUpToDate();
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- {
+ {
EditBoxStream f { editBox = editBox };
char ch;
delete f;
updatingCode = false;
}
-
+
charPos = Min(charPos, l1.count + 1);
if(!caretMove)
FindParamsTree(ast, lineNum, charPos);
if(this.functionType != ::functionType || this.instanceType != ::instanceType)
reposition = false;
- if(!this.paramsShown || reposition || paramsInsideExp != functionExp || ::instanceType) // Added instanceType here, otherwise instance popups never reposition...
+ if(!this.paramsShown || reposition || paramsInsideExp != functionExp || ::instanceType) // Added instanceType here, otherwise instance popups never reposition...
// ( Dummy exp: always ends up with same memory)
{
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
return document;
}
-void CodeEditor_Terminate()
+static int nofdigits(int v)
{
- FindParams_Terminate();
- FindCtx_Terminate();
- FreeIncludeFiles();
+ if(v == MININT) return 10 + 1;
+ if(v < 0) return nofdigits(-v) + 1;
+ if(v >= 10000)
+ {
+ if(v >= 10000000)
+ {
+ if(v >= 100000000)
+ {
+ if(v >= 1000000000)
+ return 10;
+ return 9;
+ }
+ return 8;
+ }
+ if(v >= 100000)
+ {
+ if(v >= 1000000)
+ return 7;
+ return 6;
+ }
+ return 5;
+ }
+ if(v >= 100)
+ {
+ if(v >= 1000)
+ return 4;
+ return 3;
+ }
+ if(v >= 10)
+ return 2;
+ return 1;
}