Class: ExportDialog

Inherits:
Wx::Dialog
  • Object
show all
Defined in:
lib/export_dialog.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ ExportDialog

Returns a new instance of ExportDialog.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/export_dialog.rb', line 11

def initialize(parent)
  super(parent, :title => 'Export')
  grid = Wx::FlexGridSizer.new(2, 2, 5, 5)

  label = Wx::StaticText.new(self, :label => "Tiles per file")
  @tpf_choice = Wx::Choice.new(self, :choices => %w(1 8 16 32 64 256))
  @tpf_choice.selection = 0 # for Windows
  grid.add(label, 0, Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)
  grid.add(@tpf_choice, 0, Wx::GROW|Wx::ALL, 5)

  label = Wx::StaticText.new(self, :label => "Hash size")
  @hs_choice = Wx::Choice.new(self, :choices => %w(1 5 11 23 47 97))
  @hs_choice.selection = 0 # for Windows
  grid.add(label, 0, Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)
  grid.add(@hs_choice, 0, Wx::GROW|Wx::ALL, 5)

  sizer = Wx::BoxSizer.new(Wx::VERTICAL)
  sizer.add(grid, 0, Wx::ALL, 5)

  button_sizer = create_button_sizer(Wx::OK|Wx::CANCEL)
  sizer.add(button_sizer, 0, Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)

  self.sizer = sizer
  sizer.fit(self)

  evt_choice(@tpf_choice) {|event| @hs_choice.string_selection = '1' if tiles_per_file != 1}
  evt_choice(@hs_choice) {|event| @tpf_choice.string_selection = '1' if hash_size != 1}
end

Instance Method Details

#hash_sizeObject



7
8
9
# File 'lib/export_dialog.rb', line 7

def hash_size
  @hs_choice.string_selection.to_i
end

#tiles_per_fileObject



3
4
5
# File 'lib/export_dialog.rb', line 3

def tiles_per_file
  @tpf_choice.string_selection.to_i
end