Class: FXSVGMapExporterOptionsDialogBox

Inherits:
FXDialogBox
  • Object
show all
Defined in:
lib/IFMapper/FXSVGMapExporterOptionsDialogBox.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, title, map) ⇒ FXSVGMapExporterOptionsDialogBox

Returns a new instance of FXSVGMapExporterOptionsDialogBox.



3
4
5
6
7
8
9
10
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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/IFMapper/FXSVGMapExporterOptionsDialogBox.rb', line 3

def initialize(parent, title, map)

  decor = DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE

  super( parent, title, decor, 40, 40, 0, 0 )
  mainFrame = FXVerticalFrame.new(self,
                  FRAME_SUNKEN|FRAME_THICK|
                  LAYOUT_FILL_X|LAYOUT_FILL_Y)


  # Show location text (draw_roomnames):
  # ====================================
  showlocationtext = FXCheckButton.new(mainFrame, BOX_SVG_SHOWLOCTEXT, nil, 0,
          ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
          LAYOUT_SIDE_RIGHT)
  showlocationtext.setCheck(true)
  showlocationtext.tipText = BOX_SVG_SHOWLOCTEXT_TOOLTIP
  map.options['draw_roomnames'] = true

  showlocationtext.connect(SEL_COMMAND) {
    map.options['draw_roomnames'] = (showlocationtext.check == true)
  }


  # Show location numbers (print_room_nums):
  # ========================================
  showlocationnumbers = FXCheckButton.new(mainFrame, BOX_SVG_SHOWLOCNUMS, nil, 0,
                ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
                LAYOUT_SIDE_RIGHT)
  showlocationnumbers.setCheck(true)
  showlocationnumbers.tipText = BOX_SVG_SHOWLOCNUMS_TOOLTIP
  map.options['print_room_nums'] = true

  showlocationnumbers.connect(SEL_COMMAND) {
    map.options['print_room_nums'] = (showlocationnumbers.check == true)
  }


  # Show interactive location information:
  # ======================================

  # Section title label
  showinteractivelabel = FXLabel.new(mainFrame, BOX_SVG_SHOWINTERTITLE, nil, 0, LAYOUT_FILL_X)
  showinteractivelabel.padTop = 10

  # Objects checkbox (draw_objects):
  showinteractiveobjects = FXCheckButton.new(mainFrame, BOX_SVG_SHOWINTEROBJECTS, nil, 0,
                ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
                LAYOUT_SIDE_RIGHT)
  showinteractiveobjects.setCheck(true)
  showinteractiveobjects.padLeft = 20
  showinteractiveobjects.tipText = BOX_SVG_SHOWINTEROBJECTS_TOOLTIP
  map.options['draw_objects'] = true

  showinteractiveobjects.connect(SEL_COMMAND) {
    map.options['draw_objects'] = (showinteractiveobjects.check == true)
  }

  # Tasks checkbox (draw_tasks):
  showinteractivetasks = FXCheckButton.new(mainFrame, BOX_SVG_SHOWINTERTASKS, nil, 0,
                ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
                LAYOUT_SIDE_RIGHT)
  showinteractivetasks.setCheck(true)
  showinteractivetasks.padLeft = 20
  showinteractivetasks.tipText = BOX_SVG_SHOWINTERTASKS_TOOLTIP
  map.options['draw_tasks'] = true

  showinteractivetasks.connect(SEL_COMMAND) {
    map.options['draw_tasks'] = (showinteractivetasks.check == true)
  }

  # Comments checkbox (draw_comments):
  showinteractivecomments = FXCheckButton.new(mainFrame, BOX_SVG_SHOWINTERCOMMENTS, nil, 0,
                ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
                LAYOUT_SIDE_RIGHT)
  showinteractivecomments.setCheck(true)
  showinteractivecomments.padLeft = 20
  showinteractivecomments.tipText = BOX_SVG_SHOWINTERCOMMENTS_TOOLTIP
  map.options['draw_comments'] = true

  showinteractivecomments.connect(SEL_COMMAND) {
    map.options['draw_comments'] = (showinteractivecomments.check == true)
  }

  # Description checkbox (draw_description):
  showinteractivedescription = FXCheckButton.new(mainFrame, BOX_SVG_SHOWINTERDESCRIPTION, nil, 0,
                ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
                LAYOUT_SIDE_RIGHT)
  showinteractivedescription.setCheck(true)
  showinteractivedescription.padLeft = 20
  showinteractivedescription.tipText = BOX_SVG_SHOWINTERDESCRIPTION_TOOLTIP
  map.options['draw_description'] = true

  showinteractivedescription.connect(SEL_COMMAND) {
    map.options['draw_description'] = (showinteractivedescription.check == true)
  }


  # Show section comments (draw_sectioncomments):
  # =============================================
  showsectioncomments = FXCheckButton.new(mainFrame, BOX_SVG_SHOWSECTCOMMENTS, nil, 0,
          ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|
          LAYOUT_SIDE_RIGHT)
  showsectioncomments.setCheck(true)
  showsectioncomments.tipText = BOX_SVG_SHOWSECTCOMMENTS_TOOLTIP
  showsectioncomments.padTop = 10
  showsectioncomments.padBottom = 10
  map.options['draw_sectioncomments'] = true

  showsectioncomments.connect(SEL_COMMAND) {
    map.options['draw_sectioncomments'] = (showsectioncomments.check == true)
  }


  # Compass size (compass_size):
  # =============================================

  # Horizontal frame to hold label and slider
  compasssizeframe = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  # Compass size label
  compasssizelabel = FXLabel.new(compasssizeframe, BOX_SVG_COMPASSSIZE, nil, 0, LAYOUT_LEFT)
  compasssizelabel.tipText = BOX_SVG_COMPASSSIZE_TOOLTIP

  # Compass size slider
  compasssizeslider = FXSlider.new(compasssizeframe, nil, 0,
                SLIDER_HORIZONTAL|LAYOUT_FIX_WIDTH|
                SLIDER_TICKS_TOP|LAYOUT_RIGHT,
                :width => 100)
  compasssizeslider.range = (0..15)
  compasssizeslider.value = 3
  compasssizeslider.tipText = BOX_SVG_COMPASSSIZE_TOOLTIP
  map.options['compass_size'] = 3

  compasssizeslider.connect(SEL_COMMAND) {
    map.options['compass_size'] = (compasssizeslider.value)
  }


  # Location line thickness (room_line_width):
  # =============================================

  # Horizontal frame to hold label and slider
  locationlinethicknessframe = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  # Location line thickness label
  locationlinethicknesslabel = FXLabel.new(locationlinethicknessframe, BOX_SVG_LOCTHICKNESS, nil, 0, LAYOUT_LEFT)
  locationlinethicknesslabel.tipText = BOX_SVG_LOCTHICKNESS_TOOLTIP

  # Location line thickness slider
  locationlinethicknessslider = FXSlider.new(locationlinethicknessframe, nil, 0,
                SLIDER_HORIZONTAL|LAYOUT_FIX_WIDTH|
                SLIDER_TICKS_TOP|LAYOUT_RIGHT,
                :width => 100)
  locationlinethicknessslider.range = (0..5)
  locationlinethicknessslider.value = 2
  locationlinethicknessslider.tipText = BOX_SVG_LOCTHICKNESS_TOOLTIP
  map.options['room_line_width'] = 2

  locationlinethicknessslider.connect(SEL_COMMAND) {
    if locationlinethicknessslider.value == 0
      locationlinethicknessslider.value = 1
    end
    map.options['room_line_width'] = (locationlinethicknessslider.value)
  }


  # Connection line thickness (conn_line_width, door_line_width, draw_connections):
  # ===============================================================================

  # Horizontal frame to hold label and slider
  connectionlinethicknessframe = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  # Connection line thickness label
  connectionlinethicknesslabel = FXLabel.new(connectionlinethicknessframe, BOX_SVG_CONNTHICKNESS, nil, 0, LAYOUT_LEFT)
  connectionlinethicknesslabel.tipText = BOX_SVG_CONNTHICKNESS_TOOLTIP

  # Connection line thickness slider
  connectionlinethicknessslider = FXSlider.new(connectionlinethicknessframe, nil, 0,
                SLIDER_HORIZONTAL|LAYOUT_FIX_WIDTH|
                SLIDER_TICKS_TOP|LAYOUT_RIGHT,
                :width => 100)
  connectionlinethicknessslider.range = (0..5)
  connectionlinethicknessslider.value = 2
  connectionlinethicknessslider.tipText = BOX_SVG_CONNTHICKNESS_TOOLTIP
  map.options['conn_line_width'] = 2
  map.options['door_line_width'] = 2
  map.options['draw_connections'] = true

  connectionlinethicknessslider.connect(SEL_COMMAND) {
    map.options['conn_line_width'] = (connectionlinethicknessslider.value)
    map.options['door_line_width'] = (connectionlinethicknessslider.value)
    map.options['draw_connections'] = (connectionlinethicknessslider.value > 0)
  }


  # Colour scheme (objs_fill_colour, corner_fill_colour, num_fill_colour, door_line_colour):
  # ========================================================================================

  # Horizontal frame to hold label and popup menu
  colourschemeframe = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  # Colour scheme label
  colourschemelabel = FXLabel.new(colourschemeframe, BOX_SVG_COLOURSCHEME, nil, 0, LAYOUT_LEFT)
  colourschemelabel.tipText = BOX_SVG_COLOURSCHEME_TOOLTIP

  # Colour scheme popup
  colourschemepopup = FXPopup.new(self)
  BOX_SVG_COLOURSCHEME_OPTIONS.each { |colourschemeoption|
    FXOption.new(colourschemepopup, colourschemeoption, nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
  }

  # Colour scheme options menu
  colourschemeoptionsmenu = FXOptionMenu.new(colourschemeframe, colourschemepopup, FRAME_RAISED|FRAME_THICK|
              JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_FIX_WIDTH, :width => 100)
  colourschemeoptionsmenu.currentNo = 1
  colourschemeoptionsmenu.tipText = BOX_SVG_COLOURSCHEME_TOOLTIP
  map.options['objs_fill_colour'] = "lightgreen"
  map.options['corner_fill_colour'] = "lightgreen"
  map.options['num_fill_colour'] = "lightgreen"
  map.options['door_line_colour'] = "forestgreen"

  colourschemeoptionsmenu.connect(SEL_COMMAND) {
    case colourschemeoptionsmenu.currentNo
      when 0
        map.options['objs_fill_colour'] = "lightpink"
        map.options['corner_fill_colour'] = "lightpink"
        map.options['num_fill_colour'] = "lightpink"
        map.options['door_line_colour'] = "firebrick"
      when 1
        map.options['objs_fill_colour'] = "lightgreen"
        map.options['corner_fill_colour'] = "lightgreen"
        map.options['num_fill_colour'] = "lightgreen"
        map.options['door_line_colour'] = "forestgreen"
      when 2
        map.options['objs_fill_colour'] = "yellow"
        map.options['corner_fill_colour'] = "yellow"
        map.options['num_fill_colour'] = "yellow"
        map.options['door_line_colour'] = "goldenrod"
      when 3
        map.options['objs_fill_colour'] = "lightblue"
        map.options['corner_fill_colour'] = "lightblue"
        map.options['num_fill_colour'] = "lightblue"
        map.options['door_line_colour'] = "darkslateblue"
    end
  }


  # Export options radio buttons (split_sections, current_section_only, selected_elements_only):
  # ============================================================================================

  # Horiz line to separate this section
  FXHorizontalSeparator.new(mainFrame)

  # Vertical frame to hold the label and radio buttons
  exportoptionsframe = FXVerticalFrame.new(mainFrame, LAYOUT_FILL_X)

  # Data target - handles selection/deselection of radio buttons
  exportoptionsdatatarget = FXDataTarget.new(0)

  # Export label
  FXLabel.new(exportoptionsframe, "Export:")

  # Export - All combined radio button
  exportoptionsallcombined = FXRadioButton.new(exportoptionsframe, BOX_SVG_EXPORTALLCOMBINED, exportoptionsdatatarget, FXDataTarget::ID_OPTION)
  exportoptionsallcombined.tipText = BOX_SVG_EXPORTALLCOMBINED_TOOLTIP

  # Export - All individual files radio button
  exportoptionsallindividual = FXRadioButton.new(exportoptionsframe, BOX_SVG_EXPORTALLINDIV, exportoptionsdatatarget, FXDataTarget::ID_OPTION+1)
  exportoptionsallindividual.tipText = BOX_SVG_EXPORTALLINDIV_TOOLTIP

  # Export - Current individual file radio button
  exportoptionscurrentindividual = FXRadioButton.new(exportoptionsframe, BOX_SVG_EXPORTCURRENTINDIV, exportoptionsdatatarget, FXDataTarget::ID_OPTION+2)
  exportoptionscurrentindividual.tipText = BOX_SVG_EXPORTCURRENTINDIV_TOOLTIP

  map.options['split_sections'] = false
  map.options['current_section_only'] = false
  map.options['selected_elements_only'] = false

  # Draw selected elements only checkbox
  exportoptionsselectedonly = FXCheckButton.new(mainFrame, BOX_SVG_EXPORTSELONLY, nil, 0,
          ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|JUSTIFY_LEFT|
          LAYOUT_SIDE_RIGHT)
  exportoptionsselectedonly.setCheck(false)
  exportoptionsselectedonly.disable
  exportoptionsselectedonly.tipText = BOX_SVG_EXPORTSELONLY_TOOLTIP
  map.options['selected_elements_only'] = false

  # Draw location text for selected only checkbox
  drawlocationforselectedonly = FXCheckButton.new(mainFrame, BOX_SVG_EXPORTALLLOCSSELTXT, nil, 0,
    ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|JUSTIFY_LEFT|LAYOUT_SIDE_RIGHT)
  drawlocationforselectedonly.setCheck(false)
  drawlocationforselectedonly.disable
  drawlocationforselectedonly.tipText = BOX_SVG_EXPORTALLLOCSSELTXT_TOOLTIP
  map.options['text_for_selected_only'] = false

  exportoptionsdatatarget.connect(SEL_COMMAND) {
    case exportoptionsdatatarget.value
      when 0
        exportoptionsselectedonly.disable
        # exportoptionsselectedonly.setCheck(false)
        drawlocationforselectedonly.disable
        # drawlocationforselectedonly.setCheck(false)
        map.options['split_sections'] = false
        map.options['current_section_only'] = false
        # map.options['selected_elements_only'] = false
        # map.options['location_text_for_selected_only'] = false
        showlocationtext.enable
        map.options['draw_roomnames'] = showlocationtext.check
      when 1
        exportoptionsselectedonly.disable
        # exportoptionsselectedonly.setCheck(false)
        drawlocationforselectedonly.disable
        # drawlocationforselectedonly.setCheck(false)
        map.options['split_sections'] = true
        map.options['current_section_only'] = false
        # map.options['selected_elements_only'] = false
        # map.options['location_text_for_selected_only'] = false
        showlocationtext.enable
        map.options['draw_roomnames'] = showlocationtext.check
      when 2
        exportoptionsselectedonly.enable
        drawlocationforselectedonly.enable
        map.options['split_sections'] = true
        map.options['current_section_only'] = true
        if drawlocationforselectedonly.check
          showlocationtext.disable
          map.options['draw_roomnames'] = false
        end
      end
  }

  exportoptionsselectedonly.connect(SEL_COMMAND) {
    map.options['selected_elements_only'] = (exportoptionsselectedonly.check == true)
    if exportoptionsselectedonly.check
      drawlocationforselectedonly.disable
      drawlocationforselectedonly.setCheck(false)
    else
      drawlocationforselectedonly.enable
    end
  }

  drawlocationforselectedonly.connect(SEL_COMMAND) {
    map.options['text_for_selected_only'] = (drawlocationforselectedonly.check == true)
    if drawlocationforselectedonly.check
      showlocationtext.disable
      map.options['draw_roomnames'] = false
      exportoptionsselectedonly.disable
      exportoptionsselectedonly.setCheck(false)
    else
      showlocationtext.enable
      map.options['draw_roomnames'] = showlocationtext.check
      exportoptionsselectedonly.enable
    end
  }



  # Dialog button(s):
  # =================

  # Horizontal frame to hold button
  dialogbuttonsframe = FXHorizontalFrame.new(mainFrame,
                  LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|
                  PACK_UNIFORM_WIDTH)

  # OK button
  FXButton.new(dialogbuttonsframe, "&OK", nil, self, FXDialogBox::ID_ACCEPT,
       FRAME_RAISED|LAYOUT_FILL_X|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)



  create

end