Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gui
- $include "guih.icn"
- # основной класс фронтэнда. благодаря наличию откровенно убойной логики,этот класс наследуется от диалогового
- # окна. Хотя тут все окна такие!
- class GIF : Dialog(check_box_1, label_1, label_2, text_button_1, text_button_2, text_button_3, text_field_1, text_field_2)
- method component_setup()
- self.setup()
- end
- method end_dialog()
- end
- # отдаем команды в консоль для генерации программки, заодно проверяем установлен ли флажок upx
- method exe_gen(ev)
- src_path:=text_field_1.get_contents()
- exe_path:=text_field_2.get_contents()
- if upxed=0 then compile(src_path,exe_path) else {
- compile(src_path,exe_path)
- system("C:\WINICON\\BIN\\upx.exe -9 " || exe_path)
- }
- end
- method init_dialog()
- end
- # генерируем ucode, который будет размещен в той же (!) папке что и исходник
- method ucode_gen(ev)
- ucode_path:=text_field_1.get_contents()
- system("wicont -c " || ucode_path)
- end
- # запускаем наш Icon-суррогат
- method exe_run(ev)
- src_path:=text_field_1.get_contents()
- system("wicont -s " || src_path || " -x")
- end
- # установка флажка upx
- method upx_flag(ev)
- if check_box_1.is_checked() then upxed:=0 else upxed:=1
- end
- # закрыть окно
- method on_close(ev)
- dispose()
- end
- # параметризируем (настраиваем то есть) интерфейс и его базовые элементы
- method setup()
- self.set_attribs("size=548,257","label=Icont graphical frontend")
- self.set_min_size(300, 300)
- text_field_1 := TextField()
- text_field_1.set_pos("16", "43")
- text_field_1.set_size("513", "28")
- text_field_1.set_draw_border()
- text_field_1.set_contents("C:\\WINICON\\BIN\\")
- self.add(text_field_1)
- check_box_1 := CheckBox()
- check_box_1.set_pos("19", "163")
- check_box_1.connect(self, "upx_flag", MOUSE_PRESS_EVENT)
- check_box_1.set_toggles()
- check_box_1.set_label("Compress with UPX")
- self.add(check_box_1)
- text_button_1 := TextButton()
- text_button_1.set_pos("343", "194")
- text_button_1.connect(self, "exe_gen", BUTTON_PRESS_EVENT)
- text_button_1.clear_toggles()
- text_button_1.set_label("Create executable")
- text_button_1.set_internal_alignment("c")
- self.add(text_button_1)
- text_field_2 := TextField()
- text_field_2.set_pos("17", "112")
- text_field_2.set_size("513", "28")
- text_field_2.set_draw_border()
- text_field_2.set_contents("C:\\")
- self.add(text_field_2)
- label_1 := Label()
- label_1.set_pos("17", "17")
- label_1.set_internal_alignment("l")
- label_1.set_label("Path to Icon source file :")
- self.add(label_1)
- text_button_2 := TextButton()
- text_button_2.set_pos("215", "194")
- text_button_2.connect(self, "ucode_gen", BUTTON_PRESS_EVENT)
- text_button_2.clear_toggles()
- text_button_2.set_label("Generate ucode")
- text_button_2.set_internal_alignment("c")
- self.add(text_button_2)
- text_button_3 := TextButton()
- text_button_3.set_pos("493", "194")
- text_button_3.connect(self, "exe_run", ACTION_EVENT)
- text_button_3.clear_toggles()
- text_button_3.set_label("Run")
- text_button_3.set_internal_alignment("c")
- self.add(text_button_3)
- label_2 := Label()
- label_2.set_pos("17", "85")
- label_2.set_internal_alignment("l")
- label_2.set_label("Path to executable file :")
- self.add(label_2)
- self.connect(self, "on_close", CLOSE_BUTTON_EVENT)
- end
- initially
- self.Dialog.initially()
- end
- # запускаем !
- global upxed
- procedure main()
- local d
- upxed:=0
- d := GIF()
- d.show_modal()
- end
- procedure compile (src,exe)
- local cmd_line
- cmd_line:="wicont -o " || exe || " " || src
- system(cmd_line)
- end
- ### Ivib-v2 layout ##
- #class|Canvas|17|Name Table|table|integer|0|7|string|check_box|integer|
- #1|string|label|integer|2|string|menu|integer|1|string|menu_bar|integer
- #|1|string|text_button|integer|3|string|text_field|integer|2|string|tre
- #e|integer|1|SuperClass Name|string|Dialog|Import Name|string|gui|Butto
- #n Groups|class|ButtonGroupSet|2|Parent Canvas|1|Boxes|list|0|Checkbox
- #Groups|class|CheckBoxGroupSet|2|Parent Canvas|1|Boxes|list|0|Gen Inden
- #t|integer|3|Gen Main|integer|1|Gen Component Setup|integer|1|Gen Init
- #Dialog|integer|1|Gen Initially|integer|1|Dialog Struct|class|CDialog|4
- #|Min Width|integer|300|Min Height|integer|300|Ticker Rate|null|Attribs
- #|list|0|Name|string|Untitled|Width|integer|548|Height|integer|257|Item
- #s|list|8|class|CanvasTextField|27|Parent Canvas|1|Name|string|text_fie
- #ld_1|Class Name|string|TextField|Import Name|string|gui|X Fix|null|Y F
- #ix|null|W Fix|null|H Fix|null|W Default|null|H Default|null|X Spec|str
- #ing|16|Y Spec|string|43|W Spec|string|513|H Spec|string|28|X Align|str
- #ing|l|Y Align|string|t|Is shaded|null|Is Button Subclass|null|Draw Bor
- #der|integer|1|Attribs|list|0|Tooltip|null|Accel|null|Event Handlers|li
- #st|0|Class Variable|integer|1|Parent Component|1|Contents|string|C:\09
- #2WINICON\092BIN\092|Filter String|string||class|CanvasCheckBox|35|Pare
- #nt Canvas|1|Name|string|check_box_1|Class Name|string|CheckBox|Import
- #Name|string|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix|null|W Default|
- #integer|1|H Default|integer|1|X Spec|string|19|Y Spec|string|163|W Spe
- #c|integer|142|H Spec|integer|14|X Align|string|l|Y Align|string|t|Is s
- #haded|null|Is Button Subclass|integer|1|Draw Border|null|Attribs|list|
- #0|Tooltip|null|Accel|null|Event Handlers|list|1|list|2|string|MOUSE_PR
- #ESS_EVENT|string|upx_flag|Class Variable|integer|1|Parent Component|1|
- #Label|string|Compress with UPX|No Keyboard|null|Img Up|string|(0=shado
- #w;1=hilite;~=trans)13,c6,~~~~~~~~~~~~~~11111111111~~11111111110~~11~~~
- #~~~~00~~11~~~~~~~00~~11~~~~~~~00~~11~~~~~~~00~~11~~~~~~~00~~11~~~~~~~0
- #0~~11~~~~~~~00~~11000000000~~10000000000~~~~~~~~~~~~~~|Img Down|string
- #|(b=black;0=shadow;1=hilite;~=trans)13,c6,~~~~~~~~~~~~~~00000000001~~0
- #0000000001~~00~~~~~~~11~~00~bbbbb~11~~00~bbbbb~11~~00~bbbbb~11~~00~bbb
- #bb~11~~00~bbbbb~11~~00~~~~~~~11~~01111111111~~11111111111~~~~~~~~~~~~~
- #~|Img Width|integer|13|Img Height|integer|13|Is Checked Flag|null|Is C
- #heckbox Flag|integer|1|Parent CheckBoxGroup|null|Parent Button Group|n
- #ull|class|CanvasTextButton|36|Parent Canvas|1|Name|string|text_button_
- #1|Class Name|string|TextButton|Import Name|string|gui|X Fix|null|Y Fix
- #|null|W Fix|null|H Fix|null|W Default|integer|1|H Default|integer|1|X
- #Spec|string|343|Y Spec|string|194|W Spec|integer|135|H Spec|integer|24
- #|X Align|string|l|Y Align|string|t|Is shaded|null|Is Button Subclass|i
- #nteger|1|Draw Border|null|Attribs|list|0|Tooltip|null|Accel|null|Event
- # Handlers|list|1|list|2|string|BUTTON_PRESS_EVENT|string|exe_gen|Class
- # Variable|integer|1|Parent Component|1|Label|string|Create executable|
- #No Keyboard|null|Img Up|null|Img Down|null|Img Width|null|Img Height|n
- #ull|Is Checked Flag|null|Is Checkbox Flag|null|Parent CheckBoxGroup|nu
- #ll|Parent Button Group|null|Internal Align|string|c|class|CanvasTextFi
- #eld|27|Parent Canvas|1|Name|string|text_field_2|Class Name|string|Text
- #Field|Import Name|string|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix|nu
- #ll|W Default|null|H Default|null|X Spec|string|17|Y Spec|string|112|W
- #Spec|string|513|H Spec|string|28|X Align|string|l|Y Align|string|t|Is
- #shaded|null|Is Button Subclass|null|Draw Border|integer|1|Attribs|list
- #|0|Tooltip|null|Accel|null|Event Handlers|list|0|Class Variable|intege
- #r|1|Parent Component|1|Contents|string|C:\092|Filter String|string||cl
- #ass|CanvasLabel|27|Parent Canvas|1|Name|string|label_1|Class Name|stri
- #ng|Label|Import Name|string|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix
- #|null|W Default|integer|1|H Default|integer|1|X Spec|string|17|Y Spec|
- #string|17|W Spec|integer|182|H Spec|integer|14|X Align|string|l|Y Alig
- #n|string|t|Is shaded|null|Is Button Subclass|null|Draw Border|null|Att
- #ribs|list|0|Tooltip|null|Accel|null|Event Handlers|list|0|Class Variab
- #le|integer|1|Parent Component|1|Label|string|Path to Icon source file
- #:|Internal Align|string|l|class|CanvasTextButton|36|Parent Canvas|1|Na
- #me|string|text_button_2|Class Name|string|TextButton|Import Name|strin
- #g|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix|null|W Default|integer|1|
- #H Default|integer|1|X Spec|string|215|Y Spec|string|194|W Spec|integer
- #|114|H Spec|integer|24|X Align|string|l|Y Align|string|t|Is shaded|nul
- #l|Is Button Subclass|integer|1|Draw Border|null|Attribs|list|0|Tooltip
- #|null|Accel|null|Event Handlers|list|1|list|2|string|BUTTON_PRESS_EVEN
- #T|string|ucode_gen|Class Variable|integer|1|Parent Component|1|Label|s
- #tring|Generate ucode|No Keyboard|null|Img Up|null|Img Down|null|Img Wi
- #dth|null|Img Height|null|Is Checked Flag|null|Is Checkbox Flag|null|Pa
- #rent CheckBoxGroup|null|Parent Button Group|null|Internal Align|string
- #|c|class|CanvasTextButton|36|Parent Canvas|1|Name|string|text_button_3
- #|Class Name|string|TextButton|Import Name|string|gui|X Fix|null|Y Fix|
- #null|W Fix|null|H Fix|null|W Default|integer|1|H Default|integer|1|X S
- #pec|string|493|Y Spec|string|194|W Spec|integer|37|H Spec|integer|24|X
- # Align|string|l|Y Align|string|t|Is shaded|null|Is Button Subclass|int
- #eger|1|Draw Border|null|Attribs|list|0|Tooltip|null|Accel|null|Event H
- #andlers|list|1|list|2|string|ACTION_EVENT|string|exe_run|Class Variabl
- #e|integer|1|Parent Component|1|Label|string|Run|No Keyboard|null|Img U
- #p|null|Img Down|null|Img Width|null|Img Height|null|Is Checked Flag|nu
- #ll|Is Checkbox Flag|null|Parent CheckBoxGroup|null|Parent Button Group
- #|null|Internal Align|string|c|class|CanvasLabel|27|Parent Canvas|1|Nam
- #e|string|label_2|Class Name|string|Label|Import Name|string|gui|X Fix|
- #null|Y Fix|null|W Fix|null|H Fix|null|W Default|integer|1|H Default|in
- #teger|1|X Spec|string|17|Y Spec|string|85|W Spec|integer|175|H Spec|in
- #teger|14|X Align|string|l|Y Align|string|t|Is shaded|null|Is Button Su
- #bclass|null|Draw Border|null|Attribs|list|0|Tooltip|null|Accel|null|Ev
- #ent Handlers|list|0|Class Variable|integer|1|Parent Component|1|Label|
- #string|Path to executable file :|Internal Align|string|l|Initial Focus
- #|null|Event Handlers|list|1|list|2|string|CLOSE_BUTTON_EVENT|string|on
- #_Untitled|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement