indexing description: "Expert Interface for the elfractal Application" author: "Lars Krapf" date: "$Date$" revision: "$Revision$" class EF_EXPERT_PANEL inherit EM_PANEL EM_SHARED_THEME export {NONE} all end create make feature -- Inizialization make(a_display: EF_3D_DISPLAY) is -- Create the Expert Menu Panel require a_display: a_display /= Void do panel_view := a_display make_from_dimension(200,580) set_background_color(create {EM_COLOR}.make_with_rgb(225,225,225)) -- Examples create label_examples.make_from_text("Examples:") label_examples.set_position(10,10) add_widget(label_examples) create list_examples.make_empty list_examples.set_dimension(180,20) list_examples.set_position(10,30) list_examples.put ("Rainbow Tree") list_examples.put ("Multikoch") list_examples.put ("Sunset") list_examples.selection_changed_event.subscribe (agent change_example) add_widget(list_examples) -- Input Field for Definitions create textarea_definitions.make_empty textarea_definitions.set_dimension (180, 150) textarea_definitions.set_position (10,60) add_widget(textarea_definitions) -- # of Iterations create slider_iterations.make_from_range_horizontal (0,10) slider_iterations.set_position(80,230) slider_iterations.set_background_color (create {EM_COLOR}.make_white) slider_iterations.set_width (110) slider_iterations.set_current_value (4) add_widget(slider_iterations) create label_iterations.make_from_text("Iterations:") label_iterations.set_position(10,230) add_widget(label_iterations) -- Input Field for System create label_f.make_from_text ("F =") label_f.set_position(10,260) add_widget(label_f) create textbox_system.make_from_size(19) textbox_system.set_position(33,260) add_widget(textbox_system) -- Compile Button create button_compile.make_from_text("compile") button_compile.set_position(133,283) button_compile.mouse_clicked_event.subscribe(agent compile_event) add_widget(button_compile) -- Animate Angle create checkbox_animate.make_from_text("Animate") checkbox_animate.set_position(30,283) checkbox_animate.checked_event.subscribe (agent panel_view.set_animated(True)) checkbox_animate.unchecked_event.subscribe (agent panel_view.set_animated(False)) add_widget(checkbox_animate) end feature -- Implementation compile_event(an_event: EM_MOUSEBUTTON_EVENT) is -- Compile Button was clicked do compile end compile is -- Compile the Script and redraw do panel_view.set_system_string(create {STRING}.make_from_string(textbox_system.text)) panel_view.set_iterations(slider_iterations.current_value) panel_view.set_user_commands_string(create {STRING}.make_from_string (textarea_definitions.text)) panel_view.create_script end change_example(example_string: STRING) is -- Change the Example and redraw require example_string: example_string /= Void do slider_iterations.set_current_value (4) if example_string.is_equal("Rainbow Tree") then textarea_definitions.set_text("A=Red+F%NB=Green+F%NC=Blue+F") textbox_system.set_text("F[LAF][RBF][UCF][DCF]") compile end if example_string.is_equal("Multikoch") then textarea_definitions.set_text("Koch1=FLFRRFLF%NKoch=[LKoch1][RKoch1]") textbox_system.set_text("[UGreen+Red+Koch][DRed+Koch][LBlue+Koch][RGreen+Koch]") compile end if example_string.is_equal("Sunset") then textarea_definitions.set_text("B=Green+F[LF]%NC=Blue+F[RF]Blue-%NA=Red+F[LDA][RDA][LUA][RUA]BC") textbox_system.set_text("A") slider_iterations.set_current_value(5) compile end end feature -- Widgets -- text_list list_examples: EM_COMBOBOX [STRING] -- text area textarea_definitions: EM_TEXTAREA -- textboxes textbox_system: EM_TEXTBOX -- labels label_examples,label_help,label_iterations,label_f: EM_LABEL -- sliders slider_iterations: EM_SLIDER -- buttons button_compile: EM_BUTTON -- checkbox checkbox_animate: EM_CHECKBOX -- a reference to the 3D Panel panel_view: EF_3D_DISPLAY end