Skip to content

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
- Object_File: Ignore result of File-requesters if it is ""
- Network_Terminal:
- Data_Set is not triggering an update event
- Object_History is now working with Network_Terminal
- Renamed output and input to sent and received
- Object_History:
- Added the option to allow write operations in any case
  • Loading branch information
Dadido3 committed Feb 21, 2015
1 parent 97c4a0f commit 620b83a
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 66 deletions.
16 changes: 8 additions & 8 deletions D3hex.pbp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<section name="data">
<explorer view="Includes\Object\Data_Inspector\" pattern="0"/>
<log show="1"/>
<lastopen date="2015-01-06 18:55" user="David Vogel" host="DAVIDS_NOTEBOOK"/>
<lastopen date="2015-02-21 13:30" user="David Vogel" host="DAVIDS"/>
</section>
<section name="files">
<file name="Includes\About.pbi">
Expand Down Expand Up @@ -72,11 +72,11 @@
</file>
<file name="Includes\Object\File\Object_File.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" panelstate="++++"/>
<fingerprint md5="2cd5fbfd4faa8eb4981d1b7c60769f36"/>
<fingerprint md5="d2711460de8caa55487492e0babc9e2a"/>
</file>
<file name="Includes\Object\History\Object_History.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="++++"/>
<fingerprint md5="8475f5b1d1fba81e656304264dc6d127"/>
<fingerprint md5="3e2d90e9e7e5b1a54f30b0f8bc2642bb"/>
</file>
<file name="Includes\Object\Math\Object_Math.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" panelstate="++++"/>
Expand All @@ -87,8 +87,8 @@
<fingerprint md5="ddad6e1954ca6f6fbc0958c7ad9c588f"/>
</file>
<file name="Includes\Object\Network_Terminal\Object_Network_Terminal.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" panelstate="++++"/>
<fingerprint md5="042cdff6d165565d0acdb3f5204e1145"/>
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="++++"/>
<fingerprint md5="2ba7e402563a4c311d782f27b139c306"/>
</file>
<file name="Includes\Object\Process\Object_Process.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" panelstate="++++"/>
Expand All @@ -108,7 +108,7 @@
</file>
<file name="Includes\Object\View2D\Object_View2D.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="++++"/>
<fingerprint md5="d452ad9053e11a77afc3f9a37f9eea14"/>
<fingerprint md5="ea77294c43b8b9925191c6babb9d0921"/>
</file>
<file name="Includes\Object\View2D\Object_View2D_Settings.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="++++"/>
Expand Down Expand Up @@ -136,7 +136,7 @@
</file>
<file name="Main.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="b7d632265c7c872046f69a3577e9ed25"/>
<fingerprint md5="37eca82c0e199bb48ab0aeb301f731be"/>
</file>
</section>
<section name="targets">
Expand All @@ -163,7 +163,7 @@
<options unicode="1" xpskin="1" user="1" onerror="1"/>
<purifier enable="0" granularity="1,1,1,1"/>
<icon enable="1">Data\Images\Icon.ico</icon>
<compilecount enable="1" value="2702"/>
<compilecount enable="1" value="2706"/>
<buildcount enable="1" value="46"/>
<versioninfo enable="1">
<field3 value="D3hex"/>
Expand Down
59 changes: 38 additions & 21 deletions Includes/Object/File/Object_File.pbi
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ Procedure Object_File_Create(Requester)
Protected *Object.Object = _Object_Create()
Protected *Object_File.Object_File
Protected *Object_Output.Object_Output
Protected Filename.s

If Not *Object
ProcedureReturn #False
Expand Down Expand Up @@ -274,12 +275,15 @@ Procedure Object_File_Create(Requester)

; #### Open file
If Requester
*Object_File\Filename = OpenFileRequester("Open File", "", "", 0)
*Object_File\Mode = #Object_File_Mode_Write
*Object_File\Cached = #True
*Object_File\Shared_Read = #True
*Object_File\Shared_Write = #True
Object_File_HDD_Open(*Object)
Filename = OpenFileRequester("Open File", "", "", 0)
If Filename
*Object_File\Filename = Filename
Object_File_HDD_Open(*Object)
EndIf
EndIf

ProcedureReturn *Object
Expand Down Expand Up @@ -386,32 +390,40 @@ Procedure Object_File_Output_Event(*Object_Output.Object_Output, *Object_Event.O
Case #Object_Event_Save
If Not *Object_File\File_ID
; #### Open file
*Object_File\Filename = SaveFileRequester("Save File", "", "", 0)
*Object_File\Mode = #Object_File_Mode_Write
*Object_File\Cached = #True
*Object_File\Shared_Read = #True
*Object_File\Shared_Write = #True
Object_File_HDD_Create(*Object)
Filename = SaveFileRequester("Save File", "", "", 0)
If Filename
*Object_File\Filename = Filename
*Object_File\Mode = #Object_File_Mode_Write
*Object_File\Cached = #True
*Object_File\Shared_Read = #True
*Object_File\Shared_Write = #True
Object_File_HDD_Create(*Object)
EndIf
EndIf

Case #Object_Event_SaveAs
If Not *Object_File\File_ID
; #### Open file
*Object_File\Filename = SaveFileRequester("Save File", "", "", 0)
*Object_File\Mode = #Object_File_Mode_Write
*Object_File\Cached = #True
*Object_File\Shared_Read = #True
*Object_File\Shared_Write = #True
Object_File_HDD_Create(*Object)
Else
Filename = SaveFileRequester("Save File As", "", "", 0)
If CopyFile(*Object_File\Filename, Filename)
Filename = SaveFileRequester("Save File", "", "", 0)
If Filename
*Object_File\Filename = Filename
*Object_File\Mode = #Object_File_Mode_Write
*Object_File\Cached = #True
*Object_File\Shared_Read = #True
*Object_File\Shared_Write = #True
Object_File_HDD_Open(*Object)
Object_File_HDD_Create(*Object)
EndIf
Else
Filename = SaveFileRequester("Save File As", "", "", 0)
If Filename
If CopyFile(*Object_File\Filename, Filename)
*Object_File\Filename = Filename
*Object_File\Mode = #Object_File_Mode_Write
*Object_File\Cached = #True
*Object_File\Shared_Read = #True
*Object_File\Shared_Write = #True
Object_File_HDD_Open(*Object)
EndIf
EndIf
EndIf

Expand Down Expand Up @@ -532,7 +544,7 @@ Procedure Object_File_Set_Data(*Object_Output.Object_Output, Position.q, Size.i,
ProcedureReturn #False
EndIf

; #### Don't write over the end of the file (REMOVED, ALL ELEMENTS SHOULD ALLOW TO BE WRITTEN AT THE END WITHOUT CONVOLUTION)
; #### Don't write over the end of the file (REMOVED, ALL OBJECTS SHOULD ALLOW TO BE WRITTEN AT THE END WITHOUT CONVOLUTION)
;File_Size = Object_File_Get_Size(*Object_Output)
;If Size + Position > File_Size
; Size = File_Size - Position
Expand Down Expand Up @@ -762,6 +774,7 @@ Procedure Object_File_Window_Event_Button_File()
Protected Event_Window = EventWindow()
Protected Event_Gadget = EventGadget()
Protected Event_Type = EventType()
Protected Filename.s

Protected *Window.Window = Window_Get(Event_Window)
If Not *Window
Expand All @@ -776,7 +789,10 @@ Procedure Object_File_Window_Event_Button_File()
ProcedureReturn
EndIf

*Object_File\Filename = SaveFileRequester("Select File", *Object_File\Filename, "", 1)
Filename = SaveFileRequester("Select File", *Object_File\Filename, "", 1)
If Filename
*Object_File\Filename = Filename
EndIf

SetGadgetText(*Object_File\Editor, *Object_File\Filename)

Expand Down Expand Up @@ -1135,7 +1151,8 @@ EndIf


; IDE Options = PureBasic 5.31 (Windows - x64)
; CursorPosition = 3
; CursorPosition = 578
; FirstLine = 567
; Folding = -----
; EnableUnicode
; EnableXP
50 changes: 27 additions & 23 deletions Includes/Object/History/Object_History.pbi
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ Structure Object_History

; #### Gadget stuff
Text.i
CheckBox.i

Update.l

; #### History stuff

Always_Writable.l

List Operation_Past.Object_History_Operation() ; All virtual operations made to the input-data
List Operation_Future.Object_History_Operation() ; Available redo operations

Expand Down Expand Up @@ -416,7 +419,7 @@ Procedure Object_History_Configuration_Get(*Object.Object, *Parent_Tag.NBT_Tag)
ProcedureReturn #False
EndIf

;*NBT_Tag = NBT_Tag_Add(*Parent_Tag, "Size", #NBT_Tag_Quad) : NBT_Tag_Set_Number(*NBT_Tag, *Object_History\Size)
*NBT_Tag = NBT_Tag_Add(*Parent_Tag, "Always_Writable", #NBT_Tag_Quad) : NBT_Tag_Set_Number(*NBT_Tag, *Object_History\Always_Writable)

ProcedureReturn #True
EndProcedure
Expand All @@ -436,7 +439,7 @@ Procedure Object_History_Configuration_Set(*Object.Object, *Parent_Tag.NBT_Tag)
ProcedureReturn #False
EndIf

;*NBT_Tag = NBT_Tag(*Parent_Tag, "Size") : *Object_History\Size = NBT_Tag_Get_Number(*NBT_Tag)
*NBT_Tag = NBT_Tag(*Parent_Tag, "Always_Writable") : *Object_History\Always_Writable = NBT_Tag_Get_Number(*NBT_Tag)

ProcedureReturn #True
EndProcedure
Expand Down Expand Up @@ -903,7 +906,7 @@ Procedure Object_History_Set_Data(*Object_Output.Object_Output, Position.q, Size

Object_History_Recalculate_Past_Size(*Object)

If Not Object_History_Set_Data_Check_Recursively(*Object, Position, Size)
If Not *Object_History\Always_Writable And Not Object_History_Set_Data_Check_Recursively(*Object, Position, Size)
ProcedureReturn #False
EndIf

Expand Down Expand Up @@ -956,11 +959,7 @@ Procedure Object_History_Convolute_Check_Recursively(*Object.Object, Position.q,
Until Not PreviousElement(*Object_History\Operation_Past())
EndIf

If Not Object_Input_Convolute_Check(FirstElement(*Object\Input()), Position, Offset)
ProcedureReturn #False
EndIf

ProcedureReturn #True
ProcedureReturn Object_Input_Convolute_Check(FirstElement(*Object\Input()), Position, Offset)
EndProcedure

Procedure Object_History_Convolute(*Object_Output.Object_Output, Position.q, Offset.q)
Expand All @@ -981,7 +980,7 @@ Procedure Object_History_Convolute(*Object_Output.Object_Output, Position.q, Off

Object_History_Recalculate_Past_Size(*Object)

If Not Object_History_Convolute_Check_Recursively(*Object, Position, Offset)
If Not *Object_History\Always_Writable And Not Object_History_Convolute_Check_Recursively(*Object, Position, Offset)
ProcedureReturn #False
EndIf

Expand Down Expand Up @@ -1018,11 +1017,11 @@ Procedure Object_History_Set_Data_Check(*Object_Output.Object_Output, Position.q

Object_History_Recalculate_Past_Size(*Object)

If Not Object_History_Set_Data_Check_Recursively(*Object, Position, Size)
ProcedureReturn #False
If *Object_History\Always_Writable
ProcedureReturn #True
Else
ProcedureReturn Object_History_Set_Data_Check_Recursively(*Object, Position, Size)
EndIf

ProcedureReturn #True
EndProcedure

Procedure Object_History_Convolute_Check(*Object_Output.Object_Output, Position.q, Offset.q)
Expand All @@ -1041,11 +1040,11 @@ Procedure Object_History_Convolute_Check(*Object_Output.Object_Output, Position.

Object_History_Recalculate_Past_Size(*Object)

If Not Object_History_Convolute_Check_Recursively(*Object, Position, Offset)
ProcedureReturn #False
If *Object_History\Always_Writable
ProcedureReturn #True
Else
ProcedureReturn Object_History_Convolute_Check_Recursively(*Object, Position, Offset)
EndIf

ProcedureReturn #True
EndProcedure

Procedure Object_History_Window_Update(*Object.Object)
Expand All @@ -1064,9 +1063,11 @@ Procedure Object_History_Window_Update(*Object.Object)

SetGadgetText(*Object_History\Text, Text)

SetGadgetState(*Object_History\CheckBox, *Object_History\Always_Writable)

EndProcedure

Procedure Object_History_Window_Event_Something()
Procedure Object_History_Window_Event_CheckBox_0()
Protected Event_Window = EventWindow()
Protected Event_Gadget = EventGadget()
Protected Event_Type = EventType()
Expand All @@ -1084,7 +1085,7 @@ Procedure Object_History_Window_Event_Something()
ProcedureReturn
EndIf

; #### Some gadgetstuff here
*Object_History\Always_Writable = GetGadgetState(*Object_History\CheckBox)

EndProcedure

Expand Down Expand Up @@ -1178,12 +1179,13 @@ Procedure Object_History_Window_Open(*Object.Object)
If Not *Object_History\Window

Width = 300
Height = 50
Height = 80

*Object_History\Window = Window_Create(*Object, "History", "History", #False, 0, 0, Width, Height)

; #### Gadgets
*Object_History\Text = TextGadget(#PB_Any, 10, 10, Width-20, Height-20, "")
*Object_History\Text = TextGadget(#PB_Any, 10, 10, Width-20, Height-40, "")
*Object_History\CheckBox = CheckBoxGadget(#PB_Any, 10, Height-30, Width-20, 20, "Always writable")

SetGadgetFont(*Object_History\Text, FontID(Object_History_Font))

Expand All @@ -1192,7 +1194,7 @@ Procedure Object_History_Window_Open(*Object.Object)
BindEvent(#PB_Event_SizeWindow, @Object_History_Window_Event_SizeWindow(), *Object_History\Window\ID)
BindEvent(#PB_Event_Menu, @Object_History_Window_Event_Menu(), *Object_History\Window\ID)
BindEvent(#PB_Event_CloseWindow, @Object_History_Window_Event_CloseWindow(), *Object_History\Window\ID)
;BindGadgetEvent(*Object_History\String[0], @Object_History_Window_Event_String_0())
BindGadgetEvent(*Object_History\CheckBox, @Object_History_Window_Event_CheckBox_0())

Else
Window_Set_Active(*Object_History\Window)
Expand All @@ -1213,6 +1215,7 @@ Procedure Object_History_Window_Close(*Object.Object)
UnbindEvent(#PB_Event_SizeWindow, @Object_History_Window_Event_SizeWindow(), *Object_History\Window\ID)
UnbindEvent(#PB_Event_Menu, @Object_History_Window_Event_Menu(), *Object_History\Window\ID)
UnbindEvent(#PB_Event_CloseWindow, @Object_History_Window_Event_CloseWindow(), *Object_History\Window\ID)
UnbindGadgetEvent(*Object_History\CheckBox, @Object_History_Window_Event_CheckBox_0())

Window_Delete(*Object_History\Window)
*Object_History\Window = #Null
Expand Down Expand Up @@ -1265,6 +1268,7 @@ EndIf


; IDE Options = PureBasic 5.31 (Windows - x64)
; CursorPosition = 3
; CursorPosition = 982
; FirstLine = 964
; Folding = ------
; EnableXP
19 changes: 13 additions & 6 deletions Includes/Object/Network_Terminal/Object_Network_Terminal.pbi
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ Procedure Object_Network_Terminal_Set_Data(*Object_Output.Object_Output, Positio
ProcedureReturn #False
EndIf

Protected Object_Event.Object_Event
Protected *Temp

Select *Object_Output\i
Expand All @@ -566,6 +567,11 @@ Procedure Object_Network_Terminal_Set_Data(*Object_Output.Object_Output, Positio
*Object_Network_Terminal\Output_Chunk()\Size = Size
*Object_Network_Terminal\Sent + Size
CopyMemory(*Data, *Temp, Size)

Object_Event\Type = #Object_Link_Event_Update
Object_Event\Position = *Object_Network_Terminal\Sent
Object_Event\Size = Size
Object_Output_Event(Object_Output_Get(*Object, 0), Object_Event)
EndIf
ProcedureReturn #True
EndIf
Expand Down Expand Up @@ -982,11 +988,11 @@ Procedure Object_Network_Terminal_Window_Open(*Object.Object)
*Object_Network_Terminal\Frame[0] = FrameGadget(#PB_Any, 120, 70, 100, 70, "Internet Protocol")
*Object_Network_Terminal\Option[2] = OptionGadget(#PB_Any, 130, 90, 80, 20, "IPv4")
*Object_Network_Terminal\Option[3] = OptionGadget(#PB_Any, 130, 110, 80, 20, "IPv6")
*Object_Network_Terminal\Frame[1] = FrameGadget(#PB_Any, 230, 70, 100, 70, "Show Segments")
*Object_Network_Terminal\CheckBox[0] = CheckBoxGadget(#PB_Any, 240, 90, 80, 20, "Output")
*Object_Network_Terminal\CheckBox[1] = CheckBoxGadget(#PB_Any, 240, 110, 80, 20, "Input")
*Object_Network_Terminal\Button_Clear_Output = ButtonGadget(#PB_Any, Width-90, Height-80, 80, 20, "Clear Output")
*Object_Network_Terminal\Button_Clear_Input = ButtonGadget(#PB_Any, Width-90, Height-60, 80, 20, "Clear Input")
*Object_Network_Terminal\Frame[1] = FrameGadget(#PB_Any, 230, 70, 100, 70, "Show Segments in")
*Object_Network_Terminal\CheckBox[0] = CheckBoxGadget(#PB_Any, 240, 90, 80, 20, "Sent")
*Object_Network_Terminal\CheckBox[1] = CheckBoxGadget(#PB_Any, 240, 110, 80, 20, "Received")
*Object_Network_Terminal\Button_Clear_Output = ButtonGadget(#PB_Any, Width-90, Height-80, 80, 20, "Clear Sent")
*Object_Network_Terminal\Button_Clear_Input = ButtonGadget(#PB_Any, Width-90, Height-60, 80, 20, "Clear Received")
*Object_Network_Terminal\Button_Open = ButtonGadget(#PB_Any, Width-90, Height-40, 80, 30, "Open", #PB_Button_Toggle)

SetGadgetText(*Object_Network_Terminal\String[0], *Object_Network_Terminal\Adress)
Expand Down Expand Up @@ -1200,7 +1206,8 @@ EndIf


; IDE Options = PureBasic 5.31 (Windows - x64)
; CursorPosition = 3
; CursorPosition = 992
; FirstLine = 988
; Folding = ------
; EnableUnicode
; EnableXP
Loading

0 comments on commit 620b83a

Please sign in to comment.