ifmapper 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY.txt CHANGED
@@ -1,3 +1,7 @@
1
+ v1.0.8 - Added option to load a map from command-line.
2
+ - Bug fixed pdf output of letters near exits.
3
+ - Added support for comments in each location.
4
+
1
5
  v1.0.7 - Bug fixed cutting and pasting of rooms,
2
6
  which could overlap previous rooms in map and
3
7
  leave rooms without new connections.
@@ -10,7 +14,7 @@ v1.0.5 - Improved PDF output in Letter box mode.
10
14
  - Fixed IFM writer styles and syntax.
11
15
 
12
16
  v1.0.4 - Fixed IFM connections to same room (loop paths)
13
- - Improved PDF output, applied samwise patch.
17
+ - Improve PDF output, applied samwise patch.
14
18
  - Fixed Inform7, 6 and TADS output of loop paths.
15
19
 
16
20
  v1.0.2 - Added keyboard shortcut + and - for zooming in map
data/IFMapper.gemspec CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
2
2
 
3
3
  spec = Gem::Specification.new do |spec|
4
4
  spec.name = "ifmapper"
5
- spec.version = '1.0.7'
5
+ spec.version = '1.0.8'
6
6
  spec.author = "Gonzalo Garramuno"
7
7
  spec.email = 'ggarra13@gmail.com'
8
8
  spec.homepage = 'http://www.rubyforge.org/projects/ifmapper/'
data/IFMapper.rbw CHANGED
@@ -18,6 +18,12 @@ if __FILE__ == $0
18
18
  # Create the application windows
19
19
  application.create
20
20
 
21
+ # Optionally, open a map from command-line
22
+ file = FXMapperWindow::default_options['Map']
23
+ if file
24
+ m.open_file(file)
25
+ end
26
+
21
27
  # Run the application
22
28
  begin
23
29
  application.run
data/bin/IFMapper CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # cd to install path, so modules are found locally
5
5
  install_loc = $0.sub(/\/?[^\/]*$/, '')
6
- install_loc = install_loc + '/../'
6
+ install_loc = '..' if install_loc == '.' or install_loc == ''
7
7
  Dir.chdir(install_loc)
8
8
  $LOAD_PATH << './lib'
9
9
  require 'IFMapper/FXMapperWindow'
@@ -18,6 +18,12 @@ if __FILE__ == $0
18
18
  # Create the application windows
19
19
  application.create
20
20
 
21
+ # Optionally, open a map from command-line
22
+ file = FXMapperWindow::default_options['Map']
23
+ if file
24
+ m.open_file(file)
25
+ end
26
+
21
27
  # Run the application
22
28
  begin
23
29
  application.run
@@ -145,6 +145,8 @@ class FXMapperSettings < Hash
145
145
  language = ARGV.shift
146
146
  language = language[0,2].downcase
147
147
  self['Language'] = language
148
+ when /.*\.(?:map|ifm|gmp|t|t3m|inf)$/
149
+ self['Map'] = param
148
150
  else
149
151
  $stderr.puts "Unknown parameter '#{param}'."
150
152
  exit(1)
@@ -187,6 +189,8 @@ class FXMapperSettings < Hash
187
189
  'Grid Straight Connections' => true,
188
190
  'Grid Diagonal Connections' => false,
189
191
 
192
+ # Map options
193
+ 'Map' => nil
190
194
  }
191
195
 
192
196
  self.replace( defaults.merge(self) )
@@ -52,6 +52,10 @@ class FXMapperWindow < FXMainWindow
52
52
  @@copy_buffer = nil
53
53
  @@default_options = FXMapperSettings.new
54
54
 
55
+ def self.default_options
56
+ return @@default_options
57
+ end
58
+
55
59
  LANGUAGES = {
56
60
  'English' => 'en',
57
61
  'Español' => 'es',
@@ -155,6 +159,10 @@ class FXMapperWindow < FXMainWindow
155
159
  file = FXMapFileDialog.new(self, MSG_LOAD_MAP).filename
156
160
  return if file == ''
157
161
 
162
+ open_file( file )
163
+ end
164
+
165
+ def open_file(file)
158
166
  # First, make sure we don't have it loaded already...
159
167
  @maps.each { |m|
160
168
  if m.filename == file
@@ -214,6 +222,10 @@ class FXMapperWindow < FXMainWindow
214
222
  return
215
223
  end
216
224
 
225
+ copy_map(map, tmp, file)
226
+ end
227
+
228
+ def copy_map(map, tmp, file)
217
229
  map.copy(tmp)
218
230
  map.options.replace( @@default_options.merge(map.options) )
219
231
  map.verify_integrity
@@ -977,8 +989,8 @@ class FXMapperWindow < FXMainWindow
977
989
  cmd.connect(SEL_COMMAND, method(:cut_selected_cb))
978
990
  cmd = FXMenuCommand.new(editmenu, MENU_PASTE, nil)
979
991
  cmd.connect(SEL_COMMAND, method(:paste_selected_cb))
980
- # cmd = FXMenuCommand.new(editmenu, MENU_UNDO, nil)
981
- # cmd.connect(SEL_COMMAND, method(:undo_cb))
992
+ #cmd = FXMenuCommand.new(editmenu, MENU_UNDO, nil)
993
+ #cmd.connect(SEL_COMMAND, method(:undo_cb))
982
994
 
983
995
  # Select submenu
984
996
  FXMenuSeparator.new(editmenu)
@@ -1559,10 +1571,12 @@ class FXMapperWindow < FXMainWindow
1559
1571
  create_mdiclient
1560
1572
  create_menus
1561
1573
  create_toolbar(toolbar)
1562
- new_map
1574
+
1563
1575
 
1564
1576
  self.connect(SEL_CLOSE, method(:close_cb))
1565
1577
  show
1578
+
1579
+ new_map
1566
1580
  end
1567
1581
 
1568
1582
  def initialize(app)
@@ -1572,6 +1586,7 @@ class FXMapperWindow < FXMainWindow
1572
1586
  @mdimenu = nil
1573
1587
 
1574
1588
  create_widgets
1589
+
1575
1590
 
1576
1591
  # Trap CTRL-C signals and exit nicely
1577
1592
  trap('SIGINT') {
@@ -15,6 +15,7 @@ class FXRoomDialogBox < FXDialogBox
15
15
  @room.tasks = @tasks.text
16
16
  @room.darkness = (@darkness.checkState == 1)
17
17
  @room.desc = @desc.text
18
+ @room.comment = @comment.text
18
19
 
19
20
  @map.draw_room(@room)
20
21
  @map.update_roomlist
@@ -28,6 +29,7 @@ class FXRoomDialogBox < FXDialogBox
28
29
  @objects.text = room.objects
29
30
  @tasks.text = room.tasks
30
31
  @desc.text = room.desc
32
+ @comment.text = room.comment
31
33
 
32
34
  # Select text for quick editing if it uses default location name
33
35
  @name.setCursorPos room.name.size
@@ -42,12 +44,14 @@ class FXRoomDialogBox < FXDialogBox
42
44
  @objects.disable
43
45
  @tasks.disable
44
46
  @desc.disable
47
+ @comment.disable
45
48
  else
46
49
  @name.enable
47
50
  @darkness.enable
48
51
  @objects.enable
49
52
  @tasks.enable
50
53
  @desc.enable
54
+ @comment.enable
51
55
  end
52
56
 
53
57
  if @map.options['Location Tasks']
@@ -121,6 +125,13 @@ class FXRoomDialogBox < FXDialogBox
121
125
  @tasks.visibleRows = 8
122
126
  @tasks.visibleColumns = 40
123
127
 
128
+ @commentFrame = FXVerticalFrame.new(leftFrame, LAYOUT_SIDE_TOP|
129
+ LAYOUT_FILL_X|LAYOUT_FILL_Y)
130
+ FXLabel.new(@commentFrame, BOX_COMMENTS, nil, 0, LAYOUT_FILL_X)
131
+ @comment = FXText.new(@commentFrame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
132
+ @comment.visibleRows = 8
133
+ @comment.visibleColumns = 40
134
+
124
135
  ######## Add description
125
136
  @descFrame = FXVerticalFrame.new(all, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|
126
137
  LAYOUT_SIDE_RIGHT|LAYOUT_FILL_Y)
@@ -130,6 +141,7 @@ class FXRoomDialogBox < FXDialogBox
130
141
  @desc.visibleColumns = 70
131
142
  @desc.visibleRows = 18
132
143
 
144
+
133
145
  if modal
134
146
  buttons = FXHorizontalFrame.new(mainFrame,
135
147
  LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|
@@ -149,6 +161,7 @@ class FXRoomDialogBox < FXDialogBox
149
161
  @tasks.connect(SEL_CHANGED) { @room.tasks = @tasks.text }
150
162
  @darkness.connect(SEL_COMMAND) { copy_to() }
151
163
  @desc.connect(SEL_CHANGED) { @room.desc = @desc.text }
164
+ @comment.connect(SEL_CHANGED) { @room.comment = @comment.text }
152
165
  end
153
166
 
154
167
  @map = map
@@ -62,7 +62,8 @@ class FXConnection
62
62
  return FXSpline::bspline(p)
63
63
  end
64
64
 
65
- # PRE: If it's a loop exit that comes back to the same place, let's move it up and right
65
+ # PRE: If it's a loop exit that comes back to the same place, let's move
66
+ # it up and right
66
67
  def pdf_draw_complex_as_lines( pdf, opts )
67
68
  p = []
68
69
  maxy = opts['height'] * opts['hh'] + opts['hs_2'] + opts['margin_2']
@@ -210,8 +211,7 @@ class FXConnection
210
211
  end
211
212
  pdf.stroke_style( s )
212
213
  pdf.stroke_color Color::RGB::Black
213
- # PRE: Let's set the fill colour to white so that we can see the text
214
- pdf.fill_color Color::RGB::White
214
+ pdf.fill_color Color::RGB::Black
215
215
  if @pts.size > 0
216
216
  pdf_draw_complex(pdf, opts)
217
217
  else
data/lib/IFMapper/Room.rb CHANGED
@@ -10,6 +10,7 @@ class Room
10
10
  attr_accessor :darkness # Isxxxxxxxxxx room in darkness?
11
11
  attr_accessor :x, :y # Room location in grid
12
12
  attr_accessor :desc # Room description
13
+ attr_accessor :comment # Room comment
13
14
 
14
15
  DIR_TO_VECTOR = {
15
16
  0 => [ 0, -1 ],
@@ -31,16 +32,20 @@ class Room
31
32
  @x = vars.shift
32
33
  @y = vars.shift
33
34
  @desc = nil
35
+ @comment = nil
34
36
  if not vars.empty? and vars[0].kind_of?(String)
35
37
  @desc = vars.shift
36
38
  @desc.gsub!(/(\w)\s*\n/, '\1 ')
37
39
  @desc.sub!(/\n+$/, '')
38
40
  @desc.strip!
39
41
  end
42
+ if not vars.empty? and vars[0].kind_of?(String)
43
+ @comment = vars.shift
44
+ end
40
45
  end
41
46
 
42
47
  def marshal_dump
43
- [ @name, @objects, @tasks, @exits, @darkness, @x, @y, @desc ]
48
+ [ @name, @objects, @tasks, @exits, @darkness, @x, @y, @desc, @comment ]
44
49
  end
45
50
 
46
51
  def [](dir)
@@ -348,6 +348,7 @@ BOX_OBJECTS = 'Objects: '
348
348
  BOX_DARKNESS = 'Darkness'
349
349
  BOX_TASKS = 'Tasks: '
350
350
  BOX_DESCRIPTION = 'Description: '
351
+ BOX_COMMENTS = 'Comments: '
351
352
 
352
353
  BOX_CONNECTION_TYPE = 'Connection Type: '
353
354
  BOX_CONNECTION_TYPE_TEXT = [
@@ -354,6 +354,7 @@ BOX_OBJECTS = 'Objetos: '
354
354
  BOX_DARKNESS = 'Oscuridad'
355
355
  BOX_TASKS = 'Tareas: '
356
356
  BOX_DESCRIPTION = 'Descripción: '
357
+ BOX_COMMENTS = 'Comments: '
357
358
 
358
359
  BOX_CONNECTION_TYPE = 'Tipo de Conexión: '
359
360
  BOX_CONNECTION_TYPE_TEXT = [
data/maps/AllRoads.map CHANGED
Binary file
data/maps/Aotearoa.map CHANGED
Binary file
data/maps/Revolution.map CHANGED
Binary file
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifmapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 7
10
- version: 1.0.7
9
+ - 8
10
+ version: 1.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gonzalo Garramuno
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-09 00:00:00 -03:00
18
+ date: 2011-02-18 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -218,6 +218,7 @@ files:
218
218
  - maps/sherbet.map
219
219
  - maps/simple.map
220
220
  - maps/slouch.map
221
+ - maps/Spelunker's_Quest.map
221
222
  - maps/splashdown.map
222
223
  - maps/spring.map
223
224
  - maps/squarecircle.map