ifmapper 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,92 @@
1
+
2
+ require 'fox12/colors'
3
+
4
+ class FXMapColorBox < FXDialogBox
5
+
6
+ def copy_from(map)
7
+ @backwell.rgba = map.options['BG Color']
8
+ @boxwell.rgba = map.options['Box BG Color']
9
+ @boxdarknesswell.rgba = map.options['Box Darkness Color']
10
+ @boxnumberwell.rgba = map.options['Box Number Color']
11
+ @boxborderwell.rgba = map.options['Box Border Color']
12
+ @arrowwell.rgba = map.options['Arrow Color']
13
+ @map = map
14
+ end
15
+
16
+ def copy_to(sender, id, event)
17
+ @map.options['BG Color'] = @backwell.rgba
18
+ @map.options['Box BG Color'] = @boxwell.rgba
19
+ @map.options['Box Darkness Color'] = @boxdarknesswell.rgba
20
+ @map.options['Box Number Color'] = @boxnumberwell.rgba
21
+ @map.options['Box Border Color'] = @boxborderwell.rgba
22
+ @map.options['Arrow Color'] = @arrowwell.rgba
23
+ @map.draw
24
+ end
25
+
26
+ def initialize(parent)
27
+ decor = DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE
28
+ super(parent, "Color Preferences", decor)
29
+
30
+ # pane for the buttons
31
+ contents = FXVerticalFrame.new(self, (FRAME_SUNKEN|LAYOUT_FILL_Y|
32
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
33
+
34
+ frame = FXHorizontalFrame.new(contents, (FRAME_SUNKEN|LAYOUT_FILL_X|
35
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
36
+
37
+ FXLabel.new(frame, "&Background Color", nil,
38
+ JUSTIFY_CENTER_X|LAYOUT_FILL_X)
39
+ @backwell = FXColorWell.new(frame, FXColor::White,
40
+ nil, 0, (LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT|
41
+ LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 100, 30)
42
+ @backwell.connect(SEL_COMMAND, method(:copy_to))
43
+
44
+ frame = FXHorizontalFrame.new(contents, (FRAME_SUNKEN|LAYOUT_FILL_X|
45
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
46
+ FXLabel.new(frame, "&Arrows Color", nil,
47
+ JUSTIFY_CENTER_X|LAYOUT_FILL_X)
48
+ @arrowwell = FXColorWell.new(frame, FXColor::White,
49
+ nil, 0, (LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT|
50
+ LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 100, 30)
51
+ @arrowwell.connect(SEL_COMMAND, method(:copy_to))
52
+
53
+ frame = FXHorizontalFrame.new(contents, (FRAME_SUNKEN|LAYOUT_FILL_X|
54
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
55
+ FXLabel.new(frame, "&Box Background Color", nil,
56
+ JUSTIFY_CENTER_X|LAYOUT_FILL_X)
57
+ @boxwell = FXColorWell.new(frame, FXColor::White,
58
+ nil, 0, (LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT|
59
+ LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 100, 30)
60
+ @boxwell.connect(SEL_COMMAND, method(:copy_to))
61
+
62
+ frame = FXHorizontalFrame.new(contents, (FRAME_SUNKEN|LAYOUT_FILL_X|
63
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
64
+ FXLabel.new(frame, "&Box Darkness Color", nil,
65
+ JUSTIFY_CENTER_X|LAYOUT_FILL_X)
66
+ @boxdarknesswell = FXColorWell.new(frame, FXColor::White,
67
+ nil, 0, (LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT|
68
+ LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 100, 30)
69
+ @boxdarknesswell.connect(SEL_COMMAND, method(:copy_to))
70
+
71
+ frame = FXHorizontalFrame.new(contents, (FRAME_SUNKEN|LAYOUT_FILL_X|
72
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
73
+ FXLabel.new(frame, "&Box Border Color", nil,
74
+ JUSTIFY_CENTER_X|LAYOUT_FILL_X)
75
+ @boxborderwell = FXColorWell.new(frame, FXColor::White,
76
+ nil, 0, (LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT|
77
+ LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 100, 30)
78
+ @boxborderwell.connect(SEL_COMMAND, method(:copy_to))
79
+
80
+ frame = FXHorizontalFrame.new(contents, (FRAME_SUNKEN|LAYOUT_FILL_X|
81
+ LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 10, 10)
82
+ FXLabel.new(frame, "&Box Number Color", nil,
83
+ JUSTIFY_CENTER_X|LAYOUT_FILL_X)
84
+ @boxnumberwell = FXColorWell.new(frame, FXColor::White,
85
+ nil, 0, (LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT|
86
+ LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 100, 30)
87
+ @boxnumberwell.connect(SEL_COMMAND, method(:copy_to))
88
+
89
+ create
90
+ show
91
+ end
92
+ end
@@ -6,13 +6,71 @@ class FXMapDialogBox < FXDialogBox
6
6
  @map.name = @name.text
7
7
  @map.creator = @creator.text
8
8
  @map.navigation = (@read.checkState == 1)
9
+
10
+ if @map.navigation
11
+ @name.disable
12
+ @creator.disable
13
+ @width.disable
14
+ @height.disable
15
+ else
16
+ @name.enable
17
+ @creator.enable
18
+ @width.enable
19
+ @height.enable
20
+ end
21
+
22
+ w = @width.text.to_i
23
+ h = @height.text.to_i
24
+
9
25
  @map.update_title
26
+
27
+ if w != @map.width or h != @map.height
28
+ if w < @map.width or h < @map.height
29
+ rooms = []
30
+ @map.sections.each { |s|
31
+ s.rooms.each { |r|
32
+ if r.x <= w or r.y <= h
33
+ rooms << [s, r]
34
+ end
35
+ }
36
+ }
37
+ if not rooms.empty?
38
+ d = FXWarningBox.new(@map.window, "When changing map size,\nsome rooms will be left outside of map.\nThese rooms will be deleted.\nAre you sure you want to do this?")
39
+ if d.execute == 0
40
+ copy_from(@map)
41
+ return
42
+ end
43
+ rooms.each { |p|
44
+ p[0].delete_room(p[1])
45
+ }
46
+ end
47
+ end
48
+ @map.width = w
49
+ @map.height = h
50
+ @map.zoom = @map.zoom
51
+ @map.create_pathmap
52
+ @map.draw
53
+ end
54
+
10
55
  end
11
56
 
12
57
  def copy_from(map)
13
58
  @name.text = map.name
14
59
  @creator.text = map.creator
15
60
  @read.checkState = map.navigation
61
+ @width.text = map.width.to_s
62
+ @height.text = map.height.to_s
63
+ if map.navigation
64
+ @name.disable
65
+ @creator.disable
66
+ @width.disable
67
+ @height.disable
68
+ else
69
+ @name.enable
70
+ @creator.enable
71
+ @width.enable
72
+ @height.enable
73
+ end
16
74
  @map = map
17
75
  end
18
76
 
@@ -24,24 +82,42 @@ class FXMapDialogBox < FXDialogBox
24
82
  FRAME_SUNKEN|FRAME_THICK|
25
83
  LAYOUT_FILL_X|LAYOUT_FILL_Y)
26
84
 
85
+ @read = FXCheckButton.new(mainFrame, "Read Only Map", nil, 0,
86
+ ICON_BEFORE_TEXT|LAYOUT_LEFT|LAYOUT_SIDE_TOP|
87
+ LAYOUT_SIDE_RIGHT)
88
+
27
89
  frame = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
28
90
 
29
91
  FXLabel.new(frame, "Name: ", nil, 0, LAYOUT_FILL_X)
30
- @name = FXTextField.new(frame, 40, nil, 0, LAYOUT_FILL_ROW)
92
+ @name = FXTextField.new(frame, 42, nil, 0, LAYOUT_FILL_ROW)
31
93
 
32
- frame = FXVerticalFrame.new(mainFrame,
33
- LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y)
94
+ frame = FXHorizontalFrame.new(mainFrame,
95
+ LAYOUT_FILL_X|LAYOUT_FILL_Y)
34
96
 
35
97
  FXLabel.new(frame, "Creator: ", nil, 0, LAYOUT_FILL_X)
36
98
  @creator = FXTextField.new(frame, 40, nil, 0, LAYOUT_FILL_ROW)
37
-
38
- @read = FXCheckButton.new(frame, "Read Only Map", nil, 0,
39
- ICON_BEFORE_TEXT|LAYOUT_LEFT|
40
- LAYOUT_SIDE_RIGHT)
99
+
100
+ frame = FXHorizontalFrame.new(mainFrame,
101
+ LAYOUT_SIDE_TOP|FRAME_SUNKEN|
102
+ LAYOUT_FILL_X|LAYOUT_FILL_Y)
103
+
104
+ frame2 = FXVerticalFrame.new(frame,
105
+ LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y )
106
+ FXLabel.new(frame2, "Map Width", nil, 0, LAYOUT_FILL_X)
107
+ @width = FXTextField.new( frame2, 6, nil, 0,
108
+ TEXTFIELD_INTEGER|LAYOUT_FILL_ROW)
109
+
110
+ frame2 = FXVerticalFrame.new(frame,
111
+ LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y )
112
+ FXLabel.new(frame2, "Map Height", nil, 0, LAYOUT_FILL_X)
113
+ @height = FXTextField.new( frame2, 6, nil, 0,
114
+ TEXTFIELD_INTEGER|LAYOUT_FILL_ROW)
41
115
 
42
116
  @name.connect(SEL_CHANGED) { copy_to() }
43
117
  @creator.connect(SEL_CHANGED) { copy_to() }
44
118
  @read.connect(SEL_COMMAND) { copy_to() }
119
+ @width.connect(SEL_COMMAND) { copy_to() }
120
+ @height.connect(SEL_COMMAND) { copy_to() }
45
121
 
46
122
  @parent = parent
47
123
 
@@ -34,6 +34,7 @@ class FXMapperSettings < Hash
34
34
  'Automatic Connection' => true,
35
35
 
36
36
  # Display options
37
+ 'Use Room Cursor' => false,
37
38
  'Paths as Curves' => true,
38
39
  'Location Numbers' => true,
39
40
  'Grid Boxes' => true,
@@ -26,13 +26,14 @@ require 'IFMapper/FXWarningBox'
26
26
  require 'IFMapper/FXAboutDialogBox'
27
27
  require 'IFMapper/FXSearchDialogBox'
28
28
  require 'IFMapper/FXMapFileDialog'
29
+ require 'IFMapper/FXMapColorBox'
29
30
  require 'IFMapper/IFMReader'
30
31
 
31
32
 
32
33
  class FXMapperWindow < FXMainWindow
33
34
 
34
35
  PROGRAM_NAME = "Interactive Fiction Mapper"
35
- VERSION = 0.5
36
+ VERSION = 0.6
36
37
  AUTHOR = "Gonzalo Garramuno"
37
38
  TITLE = "#{PROGRAM_NAME} v#{VERSION} - Written by #{AUTHOR}"
38
39
 
@@ -74,7 +75,7 @@ class FXMapperWindow < FXMainWindow
74
75
  # If not, we need to create a new map
75
76
  make_new_map = false
76
77
  if @maps.size == 1
77
- @maps[0].pages.each { |p|
78
+ @maps[0].sections.each { |p|
78
79
  if p.rooms.size != 0
79
80
  make_new_map = true
80
81
  break
@@ -111,7 +112,7 @@ class FXMapperWindow < FXMainWindow
111
112
  map.create_pathmap
112
113
  map.update_title
113
114
  map.window.create
114
- update_page
115
+ update_section
115
116
  status "Loaded '#{file}'."
116
117
  end
117
118
 
@@ -323,7 +324,7 @@ class FXMapperWindow < FXMainWindow
323
324
  end
324
325
 
325
326
  def self.copy_selected(map)
326
- selection = map.pages[map.page].rooms.find_all { |r| r.selected }
327
+ selection = map.sections[map.section].rooms.find_all { |r| r.selected }
327
328
  return if selection.size > 1
328
329
  @@copy_buffer = selection[0]
329
330
  end
@@ -334,7 +335,7 @@ class FXMapperWindow < FXMainWindow
334
335
  end
335
336
 
336
337
  def self.paste_selected(map)
337
- selection = map.pages[map.page].rooms.find_all { |r| r.selected }
338
+ selection = map.sections[map.section].rooms.find_all { |r| r.selected }
338
339
  selection.each { |r| r.copy(@@copy_buffer) }
339
340
  end
340
341
 
@@ -362,18 +363,18 @@ class FXMapperWindow < FXMainWindow
362
363
  return
363
364
  end
364
365
 
365
- # sort matches by page
366
+ # sort matches by section
366
367
  matches.sort_by { |a| a[0] }
367
368
 
368
- # Jump to first page of match
369
- map.page = matches[idx][0]
370
- map.pages[map.page].rooms.each { |r| r.selected = false }
369
+ # Jump to first section of match
370
+ map.section = matches[idx][0]
371
+ map.sections[map.section].rooms.each { |r| r.selected = false }
371
372
 
372
373
  matches.each { |p, r| r.selected = true }
373
374
 
374
375
  num = matches.find_all { |p, r| p == matches[idx][0] }
375
376
 
376
- status "#{matches.size} in map, #{num.size} in page."
377
+ status "#{matches.size} in map, #{num.size} in section."
377
378
  map.draw
378
379
  end
379
380
 
@@ -383,8 +384,8 @@ class FXMapperWindow < FXMainWindow
383
384
 
384
385
  re = /#{s.text}/
385
386
  matches = []
386
- (0...map.pages.size).each { |p|
387
- map.pages[p].rooms.each { |r|
387
+ (0...map.sections.size).each { |p|
388
+ map.sections[p].rooms.each { |r|
388
389
  next unless r.name =~ re
389
390
  matches.push( [p, r] )
390
391
  }
@@ -408,20 +409,20 @@ class FXMapperWindow < FXMainWindow
408
409
  @search.show
409
410
  end
410
411
 
411
- def find_in_page(s, m, e)
412
+ def find_in_section(s, m, e)
412
413
  map = current_map
413
414
  return unless map
414
415
 
415
416
  re = /#{s.text}/
416
417
  matches = []
417
- map.pages[map.page].rooms.each { |r|
418
+ map.sections[map.section].rooms.each { |r|
418
419
  next unless r.name =~ re
419
- matches.push( [ map.page, r] )
420
+ matches.push( [ map.section, r] )
420
421
  }
421
422
  hilite_matches(map, matches, re)
422
423
  end
423
424
 
424
- def find_in_page_cb(s, m, e)
425
+ def find_in_section_cb(s, m, e)
425
426
  map = current_map
426
427
  return unless map
427
428
 
@@ -429,7 +430,7 @@ class FXMapperWindow < FXMainWindow
429
430
  if not @search
430
431
  @search = FXSearchDialogBox.new(self)
431
432
  end
432
- @search.proc = method(:find_in_page)
433
+ @search.proc = method(:find_in_section)
433
434
  @search.title = title
434
435
  @search.text = ''
435
436
  @search.show
@@ -441,8 +442,8 @@ class FXMapperWindow < FXMainWindow
441
442
 
442
443
  re = /#{s.text}/
443
444
  matches = []
444
- (0...map.pages.size).each { |p|
445
- map.pages[p].rooms.each { |r|
445
+ (0...map.sections.size).each { |p|
446
+ map.sections[p].rooms.each { |r|
446
447
  next unless r.objects =~ re
447
448
  matches.push( [p, r] )
448
449
  }
@@ -466,6 +467,18 @@ class FXMapperWindow < FXMainWindow
466
467
  @search.show
467
468
  end
468
469
 
470
+ def colors_cb(sender, id, msg)
471
+ map = current_map
472
+ return if not map
473
+
474
+ if not @colors
475
+ @colors = FXMapColorBox.new(self)
476
+ else
477
+ @colors.show
478
+ end
479
+ @colors.copy_from(map)
480
+ end
481
+
469
482
  def about_cb(sender, id, msg)
470
483
  FXAboutDialogBox.new(self, "About This Software...", <<"EOF").execute
471
484
  #{TITLE} - #{VERSION}
@@ -541,8 +554,8 @@ EOF
541
554
  FXMenuSeparator.new(editmenu)
542
555
  cmd = FXMenuCommand.new(editmenu, "&Search Location in Map\tCtl-F\tFind a Location Name in Map")
543
556
  cmd.connect(SEL_COMMAND, method(:find_in_map_cb))
544
- cmd = FXMenuCommand.new(editmenu, "&Search Location in Section\tAlt-F\tFind a Location Name in Current Page")
545
- cmd.connect(SEL_COMMAND, method(:find_in_page_cb))
557
+ cmd = FXMenuCommand.new(editmenu, "&Search Location in Section\tAlt-F\tFind a Location Name in Current Section")
558
+ cmd.connect(SEL_COMMAND, method(:find_in_section_cb))
546
559
  cmd = FXMenuCommand.new(editmenu, "&Search Object in Map\tAlt-O\tFind Location with an Object in the Map")
547
560
  cmd.connect(SEL_COMMAND, method(:find_object_in_map_cb))
548
561
 
@@ -564,27 +577,27 @@ EOF
564
577
  submenu = FXMenuPane.new(self)
565
578
  cmd = FXMenuCommand.new(submenu, "Next Section\t\tGo to Next Map Section.")
566
579
  cmd.connect(SEL_COMMAND) {
567
- next_page
580
+ next_section
568
581
  }
569
582
  cmd = FXMenuCommand.new(submenu, "Previous Section\t\tGo to Previous Map Section.")
570
583
  cmd.connect(SEL_COMMAND) {
571
- previous_page
584
+ previous_section
572
585
  }
573
586
  FXMenuSeparator.new(submenu)
574
587
  cmd = FXMenuCommand.new(submenu, "Add Section\t\tAdd a New Section to Map.")
575
588
  cmd.connect(SEL_COMMAND) {
576
589
  map = current_map
577
590
  if map
578
- map.new_page
591
+ map.new_section
579
592
  map.modified = true
580
- update_page
593
+ update_section
581
594
  end
582
595
  }
583
596
  cmd = FXMenuCommand.new(submenu, "Rename Section\t\tRename Current Section.")
584
597
  cmd.connect(SEL_COMMAND) {
585
598
  map = current_map
586
599
  if map
587
- map.rename_page
600
+ map.rename_section
588
601
  map.modified = true
589
602
  end
590
603
  }
@@ -593,7 +606,7 @@ EOF
593
606
  cmd.connect(SEL_COMMAND) {
594
607
  map = current_map
595
608
  if map
596
- map.delete_page
609
+ map.delete_section
597
610
  map.modified = true
598
611
  end
599
612
  }
@@ -658,6 +671,20 @@ EOF
658
671
  # Display submenu
659
672
  #########################
660
673
  submenu = FXMenuPane.new(self)
674
+ cmd = FXMenuCheck.new(submenu, "Use Room Cursor\t\tMake your mouse cursor a room showing the direction of exit.")
675
+ cmd.check = @@default_options['Use Room Cursor']
676
+ cmd.connect(SEL_COMMAND) { |s, m, e|
677
+ map = current_map
678
+ if map
679
+ map.options['Use Room Cursor'] = (s.check == true)
680
+ map.draw
681
+ end
682
+ }
683
+ cmd.connect(SEL_UPDATE) { |s, m, e|
684
+ map = current_map
685
+ s.check = map.options['Use Room Cursor'] if map
686
+ }
687
+
661
688
  cmd = FXMenuCheck.new(submenu, "Paths as Curves\t\tDraw complex paths as curves.")
662
689
  cmd.check = @@default_options['Paths as Curves']
663
690
  cmd.connect(SEL_COMMAND) { |s, m, e|
@@ -731,6 +758,8 @@ EOF
731
758
 
732
759
  submenu = FXMenuPane.new(self)
733
760
  cmd = FXMenuCommand.new(submenu, "Colors\t\tChange map colors.")
761
+ cmd.connect(SEL_COMMAND, method(:colors_cb))
762
+
734
763
  FXMenuSeparator.new(submenu)
735
764
  cmd = FXMenuCommand.new(submenu, "Save Preferences\t\tSave Preferences for Startup")
736
765
  cmd.connect(SEL_COMMAND) {
@@ -912,62 +941,62 @@ EOF
912
941
  cmd.connect(SEL_COMMAND) { zoom_out }
913
942
 
914
943
 
915
- # Page travel
944
+ # Section travel
916
945
  frame = FXHorizontalFrame.new(toolbar,
917
946
  LAYOUT_RIGHT|FRAME_THICK|FRAME_RAISED)
918
947
  cmd = FXButton.new(frame, "\tPrevious Section", load_icon("prevpage"),
919
948
  @mdiclient,
920
949
  0, FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
921
- cmd.connect(SEL_COMMAND) { previous_page }
950
+ cmd.connect(SEL_COMMAND) { previous_section }
922
951
 
923
- @page = FXTextField.new(frame, 5, nil, 0,
952
+ @section = FXTextField.new(frame, 5, nil, 0,
924
953
  TEXTFIELD_INTEGER|LAYOUT_FILL_ROW)
925
- @page.text = '1'
926
- @page.connect(SEL_COMMAND) { |s,m,e|
954
+ @section.text = '1'
955
+ @section.connect(SEL_COMMAND) { |s,m,e|
927
956
  v = s.text.to_i
928
957
  map = current_map
929
958
  if map
930
- map.page = v - 1
959
+ map.section = v - 1
931
960
  map.draw
932
- update_page
961
+ update_section
933
962
  end
934
963
  }
935
- @page.connect(SEL_UPDATE) { |s,m,e|
964
+ @section.connect(SEL_UPDATE) { |s,m,e|
936
965
  v = s.text.to_i
937
966
  map = current_map
938
- update_page if map
967
+ update_section if map
939
968
  }
940
969
 
941
970
  cmd = FXButton.new(frame, "\tNext Section", load_icon("nextpage"),
942
971
  @mdiclient,
943
972
  0, FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
944
- cmd.connect(SEL_COMMAND) { next_page }
973
+ cmd.connect(SEL_COMMAND) { next_section }
945
974
  end
946
975
 
947
976
  #
948
- # Update page # in toolbar widget
977
+ # Update section # in toolbar widget
949
978
  #
950
- def update_page
979
+ def update_section
951
980
  map = current_map
952
- @page.text = (map.page + 1).to_s if map
981
+ @section.text = (map.section + 1).to_s if map
953
982
  end
954
983
 
955
984
  #
956
- # Go to next page in current map
985
+ # Go to next section in current map
957
986
  #
958
- def next_page
987
+ def next_section
959
988
  map = current_map
960
- map.next_page if map
961
- update_page
989
+ map.next_section if map
990
+ update_section
962
991
  end
963
992
 
964
993
  #
965
- # Go to previous page in current map
994
+ # Go to previous section in current map
966
995
  #
967
- def previous_page
996
+ def previous_section
968
997
  map = current_map
969
- map.previous_page if map
970
- update_page
998
+ map.previous_section if map
999
+ update_section
971
1000
  end
972
1001
 
973
1002
  #
@@ -1047,5 +1076,10 @@ EOF
1047
1076
  }
1048
1077
 
1049
1078
  show
1079
+
1080
+ # Trap CTRL-C signals and exit nicely
1081
+ trap('SIGINT') {
1082
+ exit(0)
1083
+ }
1050
1084
  end
1051
1085
  end