class Object
Constants
- HOW_MANY_TIMES
Public Instance Methods
connect_skeleton()
click to toggle source
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 107 def connect_skeleton minimal(@label_file_name_top) minimal(@label_top) @array_all_buttons.each {|this_button| minimal(this_button) } hbox_containing_the_text_view_window_and_the_vbox_for_actions = gtk_hbox hbox_containing_the_text_view_window_and_the_vbox_for_actions.maximal( @scrolled_window_for_the_text_view, 5 ) hbox_containing_the_text_view_window_and_the_vbox_for_actions.minimal( @vbox_for_actions, 2 ) minimal(hbox_containing_the_text_view_window_and_the_vbox_for_actions, 2) minimal(@event_box_for_firefox) minimal(@top_table) hbox = gtk_hbox hbox.add(@button_open_a_random_cfdg_file) minimal(hbox) minimal(@button_clear) minimal(@button_quit) minimal(@button_update) minimal(@image_event_box) end
create_gtk_entries_and_checkbox_and_combobox()
click to toggle source
#¶ ↑
create_gtk_entries_and_checkbox_and_combobox
¶ ↑
Hier legt man width und height des images fest entries. Zudem wird der Gtk::CheckButton definiert.
#¶ ↑
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 179 def create_gtk_entries_and_checkbox_and_combobox # Popup on button release @combo_box.signal_connect(:event) { |widget, event| case event.event_type # event.event_type.name when Gdk::Event::BUTTON_RELEASE Thread.new { @combo_box.popup } end } # If combo box was changed, do sth @combo_box.on_changed { if @combo_box.active_iter combined = @combo_box.active_iter[0] wid,hei = combined.split('x') @entry_width.text = wid @entry_height.text = hei # also, force a decoupling again @button_check_coupled.active = false end } # entry file name contains the name of our programs @entry_filename = gtk_entry @entry_filename.set_max_length( 20 ) @entry_filename.on_activate { |w| enter_callback( w ) } @entry_filename.set_text( @last_selected_file ) # This entry contains the output.png file name. @entry_file_name = gtk_entry @entry_file_name.set_text(DEFAULT_TEXT_FOR_ENTRY_FILE_NAME) @entry_file_name.on_button_press_event { |widget, event| @entry_file_name.do_focus @entry_file_name.select_everything } @entry_cfdg_file = gtk_entry @entry_cfdg_file.set_text('') @vbox_entries_and_checkbox = gtk_vbox image = gtk_image image.set(:'gtk-preferences', ::Gtk::IconSize::MENU) @event_box_for_small_icon = gtk_event_box(image) @event_box_for_small_icon.signal_connect(:event) { |widget, event| case event.event_type when Gdk::Event::BUTTON_PRESS @button_check_coupled.set_active(true) end } hbox_with_checkbox_and_combo_box = gtk_hbox hbox_with_checkbox_and_combo_box.maximal(@combo_box,0) hbox_with_checkbox_and_combo_box.maximal( create_paned_hbox( @button_check_coupled, @event_box_for_small_icon),0 ) # ^^^ add the check-button, and the event box for small icons. @vbox_entries_and_checkbox.maximal(hbox_with_checkbox_and_combo_box) @vbox_entries_and_checkbox.maximal(@entry_filename) end
create_skeleton()
click to toggle source
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 1 def create_skeleton create_the_gtk_menubar create_the_text_field create_the_vbox_for_actions create_gtk_entries_and_checkbox_and_combobox set_main_image end
create_table()
click to toggle source
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 241 def create_table @vbox_entries_and_checkbox label = modify_bold_label('ImagePath ' ,'darkblue',:left) event_box_image_path = Gtk::EventBox.new.add(label) event_box_image_path.on_button_press_event { @entry_file_name.select_everything @entry_file_name.do_focus e 'Restoring to default '+DEFAULT_TEXT_FOR_ENTRY_FILE_NAME @entry_file_name.set_text(DEFAULT_TEXT_FOR_ENTRY_FILE_NAME) # restore to default again. } hbox_tiny = create_paned_hbox( event_box_image_path, @event_box_for_firefox ) end
create_the_callbacks()
click to toggle source
#¶ ↑
create_the_callbacks
¶ ↑
Creates the callback objects.
# ¶ ↑
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 59 def create_the_callbacks @callback_create_new_file = Proc.new { |actiongroup, action| e "`#{action.name}' new file created. " } @callback_quit_application = Proc.new { ::Gtk.main_quit } @callback_scramble_image = Proc.new { scramble_image } @callback_create_batch_gallery = Proc.new { create_batch_gallery } @callback_open_a_random_cfdg_file = Proc.new { open_a_random_cfdg_file } @callback_save_file = Proc.new { ::SaveFile.save_file } # ======================================================================= # # Here we decide what will happen when we open a new file. (File Dialog) # ======================================================================= # @callback_open_file = Proc.new { |actiongroup, action| @file_chooser_dialog = ::Gtk::FileChooserDialog.new('Open File', nil, ::Gtk::FileChooser::ACTION_OPEN, nil, [ ::Gtk::Stock::CANCEL, ::Gtk::Dialog::RESPONSE_CANCEL], [ ::Gtk::Stock::OPEN, ::Gtk::Dialog::RESPONSE_ACCEPT] ) @file_chooser_dialog.add_shortcut_folder(ENV['CFDG'].to_s) @file_chooser_dialog.add_shortcut_folder(IMG) @file_filter = gtk_file_filter @file_filter.name = 'CFDG Filter' @file_filter.add_pattern '*.cfdg' @file_chooser_dialog.add_filter(@file_filter) @file_chooser_dialog.current_folder = CFDG_DIRECTORY case @file_chooser_dialog.run when ::Gtk::Dialog::RESPONSE_ACCEPT _ = @file_chooser_dialog.filename e " filename = #{_}" open_this_file(_) end @file_chooser_dialog.destroy } end
create_the_text_field()
click to toggle source
#¶ ↑
create_the_text_field
¶ ↑
Entry so that the context free design can be added here.
#¶ ↑
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 100 def create_the_text_field @text_buffer = gtk_text_buffer @text_field = gtk_text_view(@text_buffer) @text_field.show_line_numbers = true if @text_field.respond_to? :show_line_numbers @scrolled_window_for_the_text_view = gtk_scrolled_window(@text_field) end
create_the_vbox_for_actions()
click to toggle source
#¶ ↑
create_the_vbox_for_actions
¶ ↑
#¶ ↑
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 12 def create_the_vbox_for_actions @vbox_for_actions = gtk_vbox # Port the following buttons @vbox_for_actions.minimal InsertButton.new(:background, self),0 @vbox_for_actions.minimal InsertButton.new(:square, self),0 @vbox_for_actions.minimal InsertButton.new(:triangle, self),0 @vbox_for_actions.minimal InsertButton.new(:line, self),0 @vbox_for_actions.minimal InsertButton.new(:rect, self),0 @vbox_for_actions.minimal InsertButton.new(:circle, self),0 @vbox_for_actions.minimal InsertButton.new(:hue, self),0 @vbox_for_actions.minimal InsertButton.new(:sat, self),0 @vbox_for_actions.minimal InsertButton.new(:b, self),0 @vbox_for_actions.minimal InsertButton.new(:n, self),0 @vbox_for_actions.show end
open_this_file(i)
click to toggle source
#¶ ↑
open_this_file
(open tag)¶ ↑
Use this method if you want to open a .cfdg file. It will set all necessary stuff.
#¶ ↑
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 139 def open_this_file(i) @last_selected_file = i string = File.read(@last_selected_file) _ = File.basename(@show_this_cfdg_file) set_source_buffer(string) # we set source buffer @entry_filename.set_text(@last_selected_file) @show_this_cfdg_file = @last_selected_file @label_file_name_top.set_text(_) @label_top.set_text(_) @entry_cfdg_file.set_text(@show_this_cfdg_file) update_image # as of 16.01.2008 this is also coupled with updating the image. end
run()
click to toggle source
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 237 def run create_the_callbacks end
update_image()
click to toggle source
#¶ ↑
update_image
¶ ↑
The image will be created via this method invocation.
#¶ ↑
# File lib/image_paradise/gui/shared_code/cfdg_widget/OLD_GUI_CODE_THAT_HAS_TO_BE_DELETED_EVENTUALLY.rb, line 157 def update_image if program_exists? 'cfdg' e "Updating @main_image now: #{sfancy(@main_image)}." e "Saving file: #{@confree_generator.save_file}" SaveFile.save_file( @text_buffer.text, @confree_generator.save_file ) @main_image.clear @main_image.set(DEFAULT_TEXT_FOR_ENTRY_FILE_NAME) else ewarn 'Unfortunately the program `cfdg` could not be found.' ewarn 'Is it available on the target computer system?' end end