Class: HtmlOptionsWidget

Inherits:
Fox::FXMatrix
  • Object
show all
Includes:
Fox, Responder
Defined in:
lib/piggy-gui/html_options_widget.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, options, init = true) ⇒ HtmlOptionsWidget

Returns a new instance of HtmlOptionsWidget.



12
13
14
15
16
# File 'lib/piggy-gui/html_options_widget.rb', line 12

def initialize(parent, options, init=true)
  super(parent, 2, MATRIX_BY_COLUMNS)
  @options = options
  init_gui if init
end

Instance Method Details

#add_label_to(frame, msg) ⇒ Object



22
23
24
# File 'lib/piggy-gui/html_options_widget.rb', line 22

def add_label_to(frame, msg)
  FXLabel.new(frame, msg, :opts => JUSTIFY_LEFT|LAYOUT_CENTER_Y)
end

#add_txt_to(frame, msg) ⇒ Object



26
27
28
# File 'lib/piggy-gui/html_options_widget.rb', line 26

def add_txt_to(frame, msg)
  FXLabel.new(frame, msg, :opts => JUSTIFY_LEFT)
end

#cb_flagsObject



18
19
20
# File 'lib/piggy-gui/html_options_widget.rb', line 18

def cb_flags
  ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP
end

#init_guiObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/piggy-gui/html_options_widget.rb', line 30

def init_gui
  add_label_to(self, "Output directory:")
  DirChooser.new(self, @options.localDestinationPath) { |v|
    @options.localDestinationPath = v
  }
  add_label_to(self, "Framepage:")
  gen_frame_radio_buttons = FXMatrix.new(self, 2, MATRIX_BY_COLUMNS)
  gen_frame_yes = FXRadioButton.new(gen_frame_radio_buttons, "&Yes")
  gen_frame_no = FXRadioButton.new(gen_frame_radio_buttons, "&No")
  gen_frame_yes.setCheck(@options.generateFramePage)
  gen_frame_no.setCheck(!@options.generateFramePage)
  gen_frame_yes.connect(SEL_COMMAND) {
    gen_frame_no.setCheck false
    @options.generateFramePage = true
  }
  gen_frame_no.connect(SEL_COMMAND)  {
    gen_frame_yes.setCheck false
    @options.generateFramePage = false
  }
  add_label_to(self, ""); # TODO empty cell in matrix layout
  add_zip_check = FXCheckButton.new(self, 'Add zipfile')
  add_zip_check.setCheck(@options.addZip?)
  add_zip_check.connect(SEL_COMMAND) { |sender, sel, ptr|
    @options.addZip = ptr
  }
  add_label_to(self, ""); # TODO empty cell in matrix layout
  add_slideshow_check = FXCheckButton.new(self, 'Add Javascript slideshow')
  add_slideshow_check.setCheck(@options.addSlideshow?)
  add_slideshow_check.connect(SEL_COMMAND) { |sender, sel, ptr|
    @options.addSlideshow = ptr
  }
  add_label_to(self, ""); # TODO empty cell in matrix layout
  add_slideshow_check = FXCheckButton.new(self, 'Add JavaFX slideshow')
  add_slideshow_check.setCheck(@options.addJavaFxSlideshow?)
  add_slideshow_check.connect(SEL_COMMAND) { |sender, sel, ptr|
    @options.addJavaFxSlideshow = ptr
  }
  add_label_to(self, "Style:")
  style_text_field = new_combobox(self, 32,
    10,
    nil, 0, COMBOBOX_INSERT_LAST)
  style_text_field.setFrameStyle(FRAME_SUNKEN|FRAME_THICK)
  style_text_field.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
  style_text_field.clearItems
  get_style_list.each { |style|
    style_text_field.appendItem(style)
  }
  style_text_field.setText(@options.style)
  style_text_field.connect(SEL_COMMAND) { |sender, sel, ptr|
    @options.style = ptr
  }
  add_label_to(self, "Sort order")
  sort_order_text_field = new_combobox(self, 32,
    2,
    nil, 0, COMBOBOX_INSERT_LAST)
  sort_order_text_field.setFrameStyle(FRAME_SUNKEN|FRAME_THICK)
  sort_order_text_field.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
  sort_order_text_field.clearItems
  sort_order_text_field.appendItem(PiggyOptions::SortByName)
  sort_order_text_field.appendItem(PiggyOptions::SortByTime)
  sort_order_text_field.setText(@options.sortOrder)
  sort_order_text_field.connect(SEL_COMMAND) { |sender, sel, ptr|
    @options.sortOrder = ptr
  }
  add_label_to(self, "Image size:")
  size_frame = FXHorizontalFrame.new(self, FRAME_NONE, 0, 0, 0 , 0, 0, 0, 0, 0)
  image_width_field = FXTextField.new(size_frame, 4)
  add_label_to(size_frame, " x ")
  image_height_field = FXTextField.new(size_frame, 4)
  image_width_field.setText(ruby_2_fox(@options.imageWidth.to_s))
  image_height_field.setText(ruby_2_fox(@options.imageHeight.to_s))
  image_width_field.connect(SEL_COMMAND) { |sender, sel, ptr|
    begin
      @options.imageWidth = fox_2_ruby(image_width_field.getText).to_i
    rescue StandardError => ex
      image_width_field.setText(ruby_2_fox(@options.imageWidth.to_s))
    end
  }
  image_height_field.connect(SEL_COMMAND) { |sender, sel, ptr|
    begin
      @options.imageHeight = fox_2_ruby(image_height_field.getText).to_i
    rescue StandardError => ex
      image_height_field.setText(ruby_2_fox(@options.imageHeight.to_s))
    end
  }
  add_label_to(self, "Widescreen image width:")
  w_image_width_field = FXTextField.new(self, 4)
  w_image_width_field.setText(ruby_2_fox(@options.widescreenWidth.to_s))
  w_image_width_field.connect(SEL_COMMAND) { |sender, sel, ptr|
    begin
      @options.widescreenWidth = fox_2_ruby(w_image_width_field.getText).to_i
    rescue StandardError => ex
      w_image_width_field.setText(ruby_2_fox(@options.widescreenWidth.to_s))
    end
  }
end