From 3c4338337fcab91479d5ac61871eddc2f502f659 Mon Sep 17 00:00:00 2001 From: Dadido3 Date: Sun, 12 Jul 2015 13:34:07 +0200 Subject: [PATCH] Cleanup and bugfixing - Cleanup of the code - Workaround for a PureBasic bug: http://www.purebasic.fr/english/viewtopic.php?f=4&t=62586 - Fixed the string encoding in the editor node --- D3hex.pbp | 51 ++++++++-------- Includes/D3docker/D3docker.pbi | 58 +++++++++---------- Includes/Logger.pbi | 6 +- Includes/Node_Editor.pbi | 8 ++- .../Binary_Operation/Binary_Operation.pbi | 6 +- Includes/Nodes/Copy/Copy.pbi | 6 +- .../Nodes/Data_Inspector/Data_Inspector.pbi | 6 +- Includes/Nodes/Editor/Editor.pbi | 16 ++--- Includes/Nodes/File/File.pbi | 6 +- .../Nodes/Hash_Generator/Hash_Generator.pbi | 6 +- Includes/Nodes/History/History.pbi | 6 +- .../Network_Terminal/Network_Terminal.pbi | 6 +- Includes/Nodes/Process/Process.pbi | 6 +- Includes/Nodes/Random/Random.pbi | 6 +- Includes/Nodes/View1D/View1D.pbi | 26 ++------- Includes/Nodes/View2D/View2D.pbi | 26 ++------- Includes/Window.pbi | 10 ++-- Main.pb | 4 +- 18 files changed, 105 insertions(+), 154 deletions(-) diff --git a/D3hex.pbp b/D3hex.pbp index 7f00161..a7b9174 100644 --- a/D3hex.pbp +++ b/D3hex.pbp @@ -7,7 +7,7 @@
- +
@@ -24,7 +24,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -68,15 +68,15 @@ - + - + - + @@ -84,7 +84,7 @@ - + @@ -96,42 +96,42 @@ - + - + - + - + - + - + - + - - + + - + @@ -140,7 +140,7 @@ - + @@ -152,7 +152,7 @@ - +
@@ -162,10 +162,11 @@ - + + Data\Images\Icon.ico - - + + @@ -181,8 +182,8 @@ Data\Images\Icon.ico - - + + diff --git a/Includes/D3docker/D3docker.pbi b/Includes/D3docker/D3docker.pbi index 3740f7d..8f0f63f 100644 --- a/Includes/D3docker/D3docker.pbi +++ b/Includes/D3docker/D3docker.pbi @@ -597,46 +597,42 @@ Module D3docker If Not *Gadget ProcedureReturn #Null EndIf - Protected Window.i + Protected *Window.Window Protected *params.GADGET_PARAMS=GetParams(*Gadget) With *params - AddElement(\Window()) - - PushListPosition(\Window()) - Window = OpenWindow(#PB_Any, X, Y, Width, Height, Title, Flags, WindowID(\Parent_Window)) - PopListPosition(\Window()) + *Window = AddElement(\Window()) - \Window()\Window = Window - \Window()\hWnd = WindowID(\Window()\Window) - \Window()\Gadget = *Gadget - ;SetWindowData(\Window()\Window, \Window()) - SetWindowCallback(@Window_Callback(), \Window()\Window) + *Window\Window = OpenWindow(#PB_Any, X, Y, Width, Height, Title, Flags, WindowID(\Parent_Window)) + *Window\hWnd = WindowID(*Window\Window) + *Window\Gadget = *Gadget + ;SetWindowData(*Window\Window, *Window) + SetWindowCallback(@Window_Callback(), *Window\Window) - SmartWindowRefresh(\Window()\Window, #True) + SmartWindowRefresh(*Window\Window, #True) - \Window()\Resize_Priority = Resize_Priority + *Window\Resize_Priority = Resize_Priority - \Window()\Flags_Normal = GetWindowLong_(\Window()\hWnd, #GWL_STYLE) - \Window()\Flags_Docked = \Window()\Flags_Normal - \Window()\Flags_Docked & ~#WS_POPUP - \Window()\Flags_Docked & ~#WS_SIZEBOX - \Window()\Flags_Docked & ~#WS_DLGFRAME - \Window()\Flags_Docked & ~#WS_BORDER - \Window()\Flags_Docked | #WS_CHILD - ;\Window()\Flags_Docked | #WS_EX_MDICHILD + *Window\Flags_Normal = GetWindowLong_(*Window\hWnd, #GWL_STYLE) + *Window\Flags_Docked = *Window\Flags_Normal + *Window\Flags_Docked & ~#WS_POPUP + *Window\Flags_Docked & ~#WS_SIZEBOX + *Window\Flags_Docked & ~#WS_DLGFRAME + *Window\Flags_Docked & ~#WS_BORDER + *Window\Flags_Docked | #WS_CHILD + ;*Window\Flags_Docked | #WS_EX_MDICHILD - _Window_Set_Active(*Gadget, \Window(), #False) + _Window_Set_Active(*Gadget, *Window, #False) - If \Window()\Flags_Normal & #WS_SIZEBOX - _Window_Bounds(*Gadget, \Window(), #PB_Default, #PB_Default, #PB_Default, #PB_Default) + If *Window\Flags_Normal & #WS_SIZEBOX + _Window_Bounds(*Gadget, *Window, #PB_Default, #PB_Default, #PB_Default, #PB_Default) Else - \Window()\Min_Width = Width - \Window()\Min_Height = Height - \Window()\Max_Width = \Window()\Min_Width - \Window()\Max_Height = \Window()\Min_Height + *Window\Min_Width = Width + *Window\Min_Height = Height + *Window\Max_Width = *Window\Min_Width + *Window\Max_Height = *Window\Min_Height EndIf - ProcedureReturn \Window()\Window + ProcedureReturn *Window\Window EndWith EndProcedure @@ -1383,6 +1379,7 @@ Module D3docker Default FreeStructure(*Container) : *Container = #Null + ProcedureReturn #Null EndSelect EndWith @@ -2289,7 +2286,8 @@ Module D3docker EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 41 +; CursorPosition = 1348 +; FirstLine = 1318 ; Folding = -------- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Logger.pbi b/Includes/Logger.pbi index 1496b3e..a8447e3 100644 --- a/Includes/Logger.pbi +++ b/Includes/Logger.pbi @@ -163,8 +163,6 @@ Module Logger Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() EndProcedure @@ -270,8 +268,8 @@ Module Logger EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 258 -; FirstLine = 213 +; CursorPosition = 184 +; FirstLine = 156 ; Folding = --- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Node_Editor.pbi b/Includes/Node_Editor.pbi index 358db56..9e30855 100644 --- a/Includes/Node_Editor.pbi +++ b/Includes/Node_Editor.pbi @@ -340,7 +340,9 @@ Module Node_Editor NBT::Element_Delete(*NBT_Element) - SetToolBarButtonState(Window\ToolBar, #Menu_Grid_Snapping, Window\Snapping) + If Window\Window + SetToolBarButtonState(Window\ToolBar, #Menu_Grid_Snapping, Window\Snapping) + EndIf Window\Redraw = #True @@ -1152,8 +1154,8 @@ Module Node_Editor EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 1034 -; FirstLine = 1006 +; CursorPosition = 1099 +; FirstLine = 1084 ; Folding = ---- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Binary_Operation/Binary_Operation.pbi b/Includes/Nodes/Binary_Operation/Binary_Operation.pbi index f316fee..507f4b2 100644 --- a/Includes/Nodes/Binary_Operation/Binary_Operation.pbi +++ b/Includes/Nodes/Binary_Operation/Binary_Operation.pbi @@ -871,8 +871,6 @@ Module _Node_Binary_Operation Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1089,8 +1087,8 @@ Module _Node_Binary_Operation EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 939 -; FirstLine = 923 +; CursorPosition = 871 +; FirstLine = 867 ; Folding = ----- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Copy/Copy.pbi b/Includes/Nodes/Copy/Copy.pbi index 93df542..007d8ee 100644 --- a/Includes/Nodes/Copy/Copy.pbi +++ b/Includes/Nodes/Copy/Copy.pbi @@ -339,8 +339,6 @@ Module _Node_Copy Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -686,8 +684,8 @@ Module _Node_Copy EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 407 -; FirstLine = 388 +; CursorPosition = 339 +; FirstLine = 335 ; Folding = --- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Data_Inspector/Data_Inspector.pbi b/Includes/Nodes/Data_Inspector/Data_Inspector.pbi index 0065db1..2c8bedd 100644 --- a/Includes/Nodes/Data_Inspector/Data_Inspector.pbi +++ b/Includes/Nodes/Data_Inspector/Data_Inspector.pbi @@ -769,8 +769,6 @@ Module _Node_Data_Inspector Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -968,8 +966,8 @@ Module _Node_Data_Inspector EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 845 -; FirstLine = 836 +; CursorPosition = 769 +; FirstLine = 765 ; Folding = --- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Editor/Editor.pbi b/Includes/Nodes/Editor/Editor.pbi index cbc073d..472a1e5 100644 --- a/Includes/Nodes/Editor/Editor.pbi +++ b/Includes/Nodes/Editor/Editor.pbi @@ -907,8 +907,10 @@ Module _Node_Editor *Object\Y0 = Main\Font_Height * 1.5 *Object\X0 = Main\Font_Width * (*Object\Adress_Length + 2) - *Object\X1 = *Object\X0 + Main\Font_Width * (*Object\Line_Bytes * 3 + 1) - *Object\X2 = *Object\X1 + Main\Font_Width * (*Object\Line_Bytes + 1) + *Object\X1 = Main\Font_Width * (*Object\Line_Bytes * 3 + 1) + *Object\X2 = Main\Font_Width * (*Object\Line_Bytes + 1) ; FIXME: Undo when the bug in PureBasic is fixed. Right now it's a silly workaround! + *Object\X1 + *Object\X0 + *Object\X2 + *Object\X1 *Object\Lines = Quad_Divide_Ceil(Height - *Object\Y0, Main\Font_Height) @@ -1008,7 +1010,7 @@ Module _Node_Editor Protected Metadata.a Protected String_Ascii.s{1} Protected String_Hex.s{2} - Protected *String_Temp_Buffer, String_Temp_Size + Protected *String_Temp_Buffer, String_Temp_Size.i ; String_Temp_Size is in characters (#PB_Unicode --> #PB_UTF16 --> 16 bit) If Not *Node ProcedureReturn #False @@ -1131,7 +1133,7 @@ Module _Node_Editor String_Ascii = " " Else String_Temp_Size = MultiByteToWideChar_(437, #MB_USEGLYPHCHARS, *Object\Segment()\Raw_Data+i, 1, #Null, 0) - *String_Temp_Buffer = AllocateMemory(String_Temp_Size) + *String_Temp_Buffer = AllocateMemory(String_Temp_Size*2) MultiByteToWideChar_(437, #MB_USEGLYPHCHARS, *Object\Segment()\Raw_Data+i, 1, *String_Temp_Buffer, String_Temp_Size) String_Ascii = PeekS(*String_Temp_Buffer, String_Temp_Size, #PB_Unicode) FreeMemory(*String_Temp_Buffer) @@ -1159,7 +1161,7 @@ Module _Node_Editor String_Ascii = " " Else String_Temp_Size = MultiByteToWideChar_(437, #MB_USEGLYPHCHARS, *Object\Segment()\Raw_Data+i, 1, #Null, 0) - *String_Temp_Buffer = AllocateMemory(String_Temp_Size) + *String_Temp_Buffer = AllocateMemory(String_Temp_Size*2) MultiByteToWideChar_(437, #MB_USEGLYPHCHARS, *Object\Segment()\Raw_Data+i, 1, *String_Temp_Buffer, String_Temp_Size) String_Ascii = PeekS(*String_Temp_Buffer, String_Temp_Size, #PB_Unicode) FreeMemory(*String_Temp_Buffer) @@ -2539,8 +2541,8 @@ Module _Node_Editor EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 2443 -; FirstLine = 2408 +; CursorPosition = 909 +; FirstLine = 881 ; Folding = ------- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/File/File.pbi b/Includes/Nodes/File/File.pbi index 5c98035..75a3610 100644 --- a/Includes/Nodes/File/File.pbi +++ b/Includes/Nodes/File/File.pbi @@ -977,8 +977,6 @@ Module _Node_File Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1215,8 +1213,8 @@ Module _Node_File EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 1072 -; FirstLine = 1068 +; CursorPosition = 977 +; FirstLine = 973 ; Folding = ----- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Hash_Generator/Hash_Generator.pbi b/Includes/Nodes/Hash_Generator/Hash_Generator.pbi index 0f30571..cb138ca 100644 --- a/Includes/Nodes/Hash_Generator/Hash_Generator.pbi +++ b/Includes/Nodes/Hash_Generator/Hash_Generator.pbi @@ -362,8 +362,6 @@ Module _Node_Hash_Generator Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -673,8 +671,8 @@ Module _Node_Hash_Generator EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 463 -; FirstLine = 451 +; CursorPosition = 363 +; FirstLine = 358 ; Folding = --- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/History/History.pbi b/Includes/Nodes/History/History.pbi index 73cacf0..5b42338 100644 --- a/Includes/Nodes/History/History.pbi +++ b/Includes/Nodes/History/History.pbi @@ -1126,8 +1126,6 @@ Module _Node_History Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1303,7 +1301,7 @@ Module _Node_History EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 499 -; FirstLine = 477 +; CursorPosition = 1127 +; FirstLine = 1122 ; Folding = ------ ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Network_Terminal/Network_Terminal.pbi b/Includes/Nodes/Network_Terminal/Network_Terminal.pbi index 6272ac9..a1410c9 100644 --- a/Includes/Nodes/Network_Terminal/Network_Terminal.pbi +++ b/Includes/Nodes/Network_Terminal/Network_Terminal.pbi @@ -936,8 +936,6 @@ Module _Node_Network_Terminal Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1261,8 +1259,8 @@ Module _Node_Network_Terminal EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 1025 -; FirstLine = 1015 +; CursorPosition = 937 +; FirstLine = 932 ; Folding = ------ ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Process/Process.pbi b/Includes/Nodes/Process/Process.pbi index 262320d..823f01b 100644 --- a/Includes/Nodes/Process/Process.pbi +++ b/Includes/Nodes/Process/Process.pbi @@ -825,8 +825,6 @@ Module _Node_Process Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1006,8 +1004,8 @@ Module _Node_Process EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 882 -; FirstLine = 882 +; CursorPosition = 826 +; FirstLine = 821 ; Folding = ----- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/Random/Random.pbi b/Includes/Nodes/Random/Random.pbi index 7c93c01..8404b18 100644 --- a/Includes/Nodes/Random/Random.pbi +++ b/Includes/Nodes/Random/Random.pbi @@ -417,8 +417,6 @@ Module _Node_Random Procedure Window_Event_SizeWindow() Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -594,7 +592,7 @@ Module _Node_Random EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 509 -; FirstLine = 505 +; CursorPosition = 418 +; FirstLine = 413 ; Folding = ---- ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/View1D/View1D.pbi b/Includes/Nodes/View1D/View1D.pbi index 4134d0b..62e9c17 100644 --- a/Includes/Nodes/View1D/View1D.pbi +++ b/Includes/Nodes/View1D/View1D.pbi @@ -355,22 +355,7 @@ Module _Node_View1D EndIf Select *Event\Type - Case Node::#Event_Save - - Case Node::#Event_SaveAs - - Case Node::#Event_Undo - - Case Node::#Event_Redo - - Case Node::#Event_Goto - ; #### Open window here - - Case Node::#Event_Search - ; #### Open window here - - Case Node::#Event_Search_Continue - + EndSelect ProcedureReturn #True @@ -1036,10 +1021,9 @@ Module _Node_View1D EndProcedure Procedure Window_Event_SizeWindow() - Protected Width, Height, Data_Width, Data_Height, ToolBarHeight Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() + + Protected Width, Height, Data_Width, Data_Height, ToolBarHeight Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1341,7 +1325,7 @@ Module _Node_View1D EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 703 -; FirstLine = 676 +; CursorPosition = 459 +; FirstLine = 422 ; Folding = ---- ; EnableXP \ No newline at end of file diff --git a/Includes/Nodes/View2D/View2D.pbi b/Includes/Nodes/View2D/View2D.pbi index 45d8a3f..da08df3 100644 --- a/Includes/Nodes/View2D/View2D.pbi +++ b/Includes/Nodes/View2D/View2D.pbi @@ -400,22 +400,7 @@ Module _Node_View2D EndIf Select *Event\Type - Case Node::#Event_Save - - Case Node::#Event_SaveAs - - Case Node::#Event_Undo - - Case Node::#Event_Redo - - Case Node::#Event_Goto - ; #### Open window here - - Case Node::#Event_Search - ; #### Open window here - - Case Node::#Event_Search_Continue - + EndSelect ProcedureReturn #True @@ -1140,10 +1125,9 @@ Module _Node_View2D EndProcedure Procedure Window_Event_SizeWindow() - Protected Width, Height, Data_Width, Data_Height, ToolBarHeight, ScrollBar_X_Height, ScrollBar_Y_Width Protected Event_Window = EventWindow() - Protected Event_Gadget = EventGadget() - Protected Event_Type = EventType() + + Protected Width, Height, Data_Width, Data_Height, ToolBarHeight, ScrollBar_X_Height, ScrollBar_Y_Width Protected *Window.Window::Object = Window::Get(Event_Window) If Not *Window @@ -1461,7 +1445,7 @@ Module _Node_View2D EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 1338 -; FirstLine = 1326 +; CursorPosition = 402 +; FirstLine = 385 ; Folding = ---- ; EnableXP \ No newline at end of file diff --git a/Includes/Window.pbi b/Includes/Window.pbi index a502fdf..892587f 100644 --- a/Includes/Window.pbi +++ b/Includes/Window.pbi @@ -307,9 +307,9 @@ Module Window ;SmartWindowRefresh(*Window\ID, 1) BindEvent(#PB_Event_ActivateWindow, @Event_ActivateWindow(), *Window\ID) - BindEvent(#PB_Event_MaximizeWindow, @Event_MaximizeWindow(), *Window\ID) - BindEvent(#PB_Event_MinimizeWindow, @Event_MinimizeWindow(), *Window\ID) - BindEvent(#PB_Event_RestoreWindow, @Event_RestoreWindow(), *Window\ID) + ;BindEvent(#PB_Event_MaximizeWindow, @Event_MaximizeWindow(), *Window\ID) + ;BindEvent(#PB_Event_MinimizeWindow, @Event_MinimizeWindow(), *Window\ID) + ;BindEvent(#PB_Event_RestoreWindow, @Event_RestoreWindow(), *Window\ID) If Flags & #Flag_Docked ;*Temp = Get_Active() @@ -397,8 +397,8 @@ Module Window EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 187 -; FirstLine = 169 +; CursorPosition = 313 +; FirstLine = 293 ; Folding = --- ; EnableUnicode ; EnableXP \ No newline at end of file diff --git a/Main.pb b/Main.pb index 1f4594a..1e48824 100644 --- a/Main.pb +++ b/Main.pb @@ -708,8 +708,8 @@ Module Main EndModule ; IDE Options = PureBasic 5.31 (Windows - x64) -; CursorPosition = 210 -; FirstLine = 158 +; CursorPosition = 154 +; FirstLine = 142 ; Folding = -- ; EnableUnicode ; EnableXP \ No newline at end of file