jota 0.9.0dev2 → 0.9.0dev3

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/lib/clip_array.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: clip_array.rb 271 2010-07-29 18:56:41Z dz $
2
+ # $Id: clip_array.rb 273 2010-08-01 11:46:58Z dz $
3
3
 
4
4
 
5
5
 
@@ -56,53 +56,6 @@ def set_file(file,file_and_path)
56
56
  @dirname = File.dirname(file_and_path)
57
57
  end
58
58
 
59
- #
60
- # Export
61
- #
62
-
63
- #def save_as_mbox(filename)
64
- #
65
- # filename = get_filename(filename,:save)
66
- #
67
- # puts "# saving clips to '#{filename}', format mbox" if $VERBOSE
68
- #
69
- # f = open(filename,"w")
70
- # write_mbox(f)
71
- # self.each do | clip |
72
- # f.print "From %s@localhost %s\n" %
73
- # [Version::PROGRAM_NAMELC, Time.now.ctime]
74
- # f.print(escape_from(clip.to_mbox.chomp))
75
- # f.print("\n")
76
- # end
77
- # f.close
78
- #end
79
- #
80
- #def save_as_yaml(filename)
81
- #
82
- # filename = get_filename(filename,:save)
83
- #
84
- # arr = Array.new
85
- # self.each_index do | i |
86
- # arr[i] = self[i].to_hash
87
- # end
88
- #
89
- # puts "# saving clips to '#{filename}', format yaml" if $VERBOSE
90
- #
91
- # File.open(filename,"w") do | file |
92
- # YAML::dump(arr, file)
93
- # end
94
- #end
95
-
96
- #def ClipArray.load(filename,format)
97
- #
98
- # case format
99
- # when :mbox
100
- # return ClipArray.load_from_mbox(filename)
101
- # when :yaml
102
- # return ClipArray.load_from_yaml(filename)
103
- # end
104
- #end
105
-
106
59
  def goto_regexp(re)
107
60
  return nil if re.nil?
108
61
 
@@ -186,45 +139,6 @@ def current
186
139
  return self[@current_index]
187
140
  end
188
141
 
189
- #def ClipArray.load_from_yaml(filename)
190
- #
191
- # filename = get_filename(filename,:open)
192
- # ca = self.new
193
- #
194
- # puts "# loading clips from '#{filename}', format yaml" if $VERBOSE
195
- #
196
- # begin
197
- # yaml = YAML::load_file(filename)
198
- # yaml.each_index do | i |
199
- # clip = Clip.from_hash(yaml[i])
200
- # puts "# '#{clip.title}' loaded" if $VERBOSE
201
- # ca[i] = clip
202
- # end
203
- # rescue SystemCallError
204
- # puts "# loading failed, continuing with empty clips" if $VERBOSE
205
- # end
206
- #
207
- # ca.current_index = ca.length - 1
208
- # return ca
209
- #end
210
- #
211
- #def ClipArray.load_from_mbox(filename)
212
- #
213
- # ca = self.new
214
- # str = nil
215
- #
216
- # puts "# loading clips from '#{filename}', format mbox" if $VERBOSE
217
- #
218
- # begin
219
- # file = open(get_filename(filename,:open),"r")
220
- # ca = ClipArray.read_mbox(file)
221
- # ensure
222
- # file.close
223
- # end
224
- #
225
- # return ca
226
- #end
227
-
228
142
  #
229
143
  # Locking
230
144
  #
data/lib/gui.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # $Id: gui.rb 271 2010-07-29 18:56:41Z dz $
3
+ # $Id: gui.rb 276 2010-08-03 12:39:39Z dz $
4
4
 
5
5
 
6
6
  # rdoc: see http://en.wikibooks.org/wiki/Ruby_Programming/RubyDoc
@@ -43,16 +43,19 @@ include GetText
43
43
  attr :glade
44
44
 
45
45
  def Gui.gtk_version
46
- return "GTK+ %d.%d.%d" % [Gtk::MAJOR_VERSION, Gtk::MINOR_VERSION, Gtk::MICRO_VERSION]
46
+ return "GTK+ %d.%d.%d" % [ Gtk::MAJOR_VERSION,
47
+ Gtk::MINOR_VERSION,
48
+ Gtk::MICRO_VERSION ]
47
49
  # TODO http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk#MICRO_VERSION
48
50
  end
49
51
 
50
52
  def initialize
51
53
  @data = nil
52
54
  @glade = nil
53
- @top_widget = nil
55
+ @top_window = nil
54
56
  @clip_widget = nil
55
57
  @next_autosave = Time.now
58
+ @changed = false
56
59
  end
57
60
 
58
61
  def open(filename)
@@ -63,11 +66,12 @@ def open(filename)
63
66
  return nil
64
67
  end
65
68
  set_autosave
69
+ @changed = false
66
70
  return @data
67
71
  end
68
72
 
69
73
  def close
70
- widget_to_clip(@clip_widget,@data)
74
+ update
71
75
 
72
76
  if @data
73
77
  @data.close
@@ -78,7 +82,7 @@ def clip_array
78
82
  return @data
79
83
  end
80
84
 
81
- def create_gui
85
+ def create_gui(width=nil, height=nil)
82
86
  glade_file = File.dirname(__FILE__)+"/jota.glade"
83
87
  domain = nil
84
88
  localedir = nil
@@ -101,7 +105,18 @@ def create_gui
101
105
  @top_window = @glade.get_widget("top")
102
106
  @clip_widget = @glade.get_widget("clip")
103
107
 
104
- clip_to_widget(@clip_widget,@data)
108
+
109
+ # Show
110
+ print_debug " showing widgets"
111
+ show
112
+
113
+
114
+ # Set size of top window
115
+ width = 740 if width.nil?
116
+ height = 280 if height.nil?
117
+ @top_window.resize(width, height)
118
+ print_verbose "setting window size to #{width}x#{height}"
119
+
105
120
 
106
121
  # Accelerators
107
122
  @accel_group = Gtk::AccelGroup.new
@@ -119,15 +134,15 @@ def create_gui
119
134
  @glade["menu_quit"].add_accelerator('activate', @accel_group,
120
135
  Gdk::Keyval::GDK_Q, Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE)
121
136
 
122
- # Show
123
- print_debug " showing widgets"
124
- @top_window.show
137
+
138
+ # Update buttons and stuff
125
139
  update
126
140
  set_style
127
141
  set_about_dialog
128
142
 
129
- # Call 'update' every 2 seconds
130
- Gtk.timeout_add(2000) do
143
+
144
+ # Call 'update' and 'autosave' every second
145
+ Gtk.timeout_add(1000) do
131
146
  update
132
147
  autosave
133
148
  true
@@ -160,8 +175,6 @@ end
160
175
  #
161
176
 
162
177
  def on_main_menu_pressed(widget)
163
- # update Go To menu
164
- widget_to_clip(@clip_widget,@data)
165
178
  update
166
179
  set_goto_menu
167
180
 
@@ -199,7 +212,7 @@ def on_delete_clicked(widget)
199
212
  msgbox.destroy
200
213
  end
201
214
 
202
- widget_to_clip(@clip_widget,@data)
215
+ update
203
216
 
204
217
  if pref("deletesave_enable") and not @data.current.empty? then
205
218
  deletefile = expand_filename(pref("deletesave_file"),
@@ -212,29 +225,27 @@ def on_delete_clicked(widget)
212
225
  end
213
226
 
214
227
  @data.delete
215
- clip_to_widget(@clip_widget,@data)
216
- update
228
+ @changed = true
229
+ show
217
230
  end
218
231
 
219
232
  def on_new_clicked(widget)
220
- widget_to_clip(@clip_widget,@data)
221
- @data.new
222
- clip_to_widget(@clip_widget,@data)
223
233
  update
234
+ @data.new
235
+ @changed = true
236
+ show
224
237
  end
225
238
 
226
239
  def on_next_clicked(widget)
227
- widget_to_clip(@clip_widget,@data)
228
- @data.next
229
- clip_to_widget(@clip_widget,@data)
230
240
  update
241
+ @data.next
242
+ show
231
243
  end
232
244
 
233
245
  def on_prev_clicked(widget)
234
- widget_to_clip(@clip_widget,@data)
235
- @data.prev
236
- clip_to_widget(@clip_widget,@data)
237
246
  update
247
+ @data.prev
248
+ show
238
249
  end
239
250
 
240
251
 
@@ -249,12 +260,12 @@ def on_menu_quit_activate(widget)
249
260
  end
250
261
 
251
262
  def on_menu_save_activate(widget)
252
- widget_to_clip(@clip_widget,@data)
263
+ update
253
264
  @data.save
254
265
  end
255
266
 
256
267
  def on_menu_new_activate(widget)
257
- filename = get_filename(:ask,:save)
268
+ filename = file_chooser_dialog :save
258
269
  return if filename.nil?
259
270
 
260
271
  begin
@@ -265,20 +276,19 @@ def on_menu_new_activate(widget)
265
276
  end
266
277
 
267
278
  if @data then
268
- widget_to_clip(@clip_widget, @data)
279
+ update
269
280
  @data.close
270
281
  end
271
282
 
272
283
  @data = ca
273
284
 
274
- clip_to_widget(@clip_widget,@data)
275
- update
285
+ show
276
286
  set_autosave
277
287
  set_style
278
288
  end
279
289
 
280
290
  def on_menu_open_activate(widget)
281
- filename = get_filename(:ask,:open)
291
+ filename = file_chooser_dialog :open
282
292
  return if filename.nil?
283
293
 
284
294
  begin
@@ -289,14 +299,13 @@ def on_menu_open_activate(widget)
289
299
  end
290
300
 
291
301
  if @data then
292
- widget_to_clip(@clip_widget, @data)
302
+ update
293
303
  @data.close
294
304
  end
295
305
 
296
306
  @data = ca
297
307
 
298
- clip_to_widget(@clip_widget,@data)
299
- update
308
+ show
300
309
  set_autosave
301
310
  set_style
302
311
  end
@@ -306,27 +315,10 @@ def on_menu_close_activate(widget)
306
315
  return
307
316
  end
308
317
 
309
- widget_to_clip(@clip_widget, @data)
318
+ update
310
319
  @data.close
311
320
  @data = nil
312
- clip_to_widget(@clip_widget,@data)
313
- update
314
- end
315
-
316
- def on_menu_export_mbox_activate(widget)
317
- # TODO
318
- end
319
-
320
- def on_menu_export_yaml_activate(widget)
321
- # TODO
322
- end
323
-
324
- def on_menu_import_mbox_activate(widget)
325
- # TODO
326
- end
327
-
328
- def on_menu_import_yaml_activate(widget)
329
- # TODO
321
+ show
330
322
  end
331
323
 
332
324
  def on_menu_preferences_activate(widget)
@@ -400,10 +392,9 @@ end
400
392
  #
401
393
 
402
394
  def on_menu_goto(nr)
403
- widget_to_clip(@clip_widget,@data)
404
- @data.current_index=nr
405
- clip_to_widget(@clip_widget,@data)
406
395
  update
396
+ @data.current_index=nr
397
+ show
407
398
  end
408
399
 
409
400
 
@@ -413,10 +404,9 @@ end
413
404
 
414
405
  def on_edit_text_wrap_activate(widget)
415
406
  print_debug "on_edit_text_wrap_activate called"
416
- widget_to_clip(@clip_widget,@data)
417
- @data.current.wrap = @glade["edit_text_wrap"].active?
418
- clip_to_widget(@clip_widget,@data)
419
407
  update
408
+ @data.current.wrap = @glade["edit_text_wrap"].active?
409
+ show
420
410
  set_style
421
411
  end
422
412
 
@@ -454,6 +444,18 @@ def on_fgcolor(widget)
454
444
  :pref_variable => "foreground"
455
445
  end
456
446
 
447
+ # XXX
448
+ def on_clip_button_press_event(widget,event)
449
+ print_debug "on_clip_button_press_event"
450
+ @changed = true
451
+ return false
452
+ end
453
+
454
+ def on_clip_key_press_event(widget,event)
455
+ print_debug "on_clip_key_press_event"
456
+ @changed = true
457
+ return false
458
+ end
457
459
 
458
460
  private
459
461
 
@@ -591,8 +593,6 @@ def set_buttons
591
593
  @glade["menu_close"].sensitive = false
592
594
  @glade["menu_save"].sensitive = false
593
595
  @glade["menu_goto"].sensitive = false
594
- @glade["menu_export"].sensitive = false
595
- @glade["menu_import"].sensitive = false
596
596
  else
597
597
  @glade["but_delete"].sensitive = true
598
598
  @glade["but_new"].sensitive = true
@@ -619,8 +619,6 @@ def set_buttons
619
619
  @glade["menu_close"].sensitive = true
620
620
  @glade["menu_save"].sensitive = true
621
621
  @glade["menu_goto"].sensitive = true
622
- @glade["menu_export"].sensitive = true
623
- @glade["menu_import"].sensitive = true
624
622
 
625
623
  # Gtk::ToggleButton#active= emits an activate signal
626
624
  # and thus calls on_edit_text_wrap_activate
@@ -679,7 +677,7 @@ def quit_app
679
677
  msgbox.destroy
680
678
  end
681
679
 
682
- widget_to_clip(@clip_widget,@data)
680
+ update
683
681
 
684
682
  if @data
685
683
  @data.close
@@ -762,45 +760,60 @@ def color_to_array(gdk_color)
762
760
  return [gdk_color.red, gdk_color.green, gdk_color.blue]
763
761
  end
764
762
 
765
- def get_filename(filename, mode)
766
- if filename.class == Symbol and filename == :ask then
767
- case mode
768
- when :save
769
- action = Gtk::FileChooser::ACTION_SAVE
770
- ok_button = Gtk::Stock::SAVE
771
- when :open
772
- action = Gtk::FileChooser::ACTION_OPEN
773
- ok_button = Gtk::Stock::OPEN
774
- else
775
- raise "Wrong mode #{mode} in helper:get_filename"
776
- end
763
+ def file_chooser_dialog(mode)
764
+ case mode
765
+ when :save
766
+ action = Gtk::FileChooser::ACTION_SAVE
767
+ ok_button = Gtk::Stock::SAVE
768
+ when :open
769
+ action = Gtk::FileChooser::ACTION_OPEN
770
+ ok_button = Gtk::Stock::OPEN
771
+ else
772
+ raise "Wrong mode #{mode} in Gui#file_chooser_dialog"
773
+ end
777
774
 
778
- title = "Select Filename"
775
+ title = "Select Filename"
779
776
 
780
- dialog = Gtk::FileChooserDialog.new(
781
- title,
782
- nil,
783
- action,
784
- nil,
785
- [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
786
- [ok_button, Gtk::Dialog::RESPONSE_ACCEPT])
787
777
 
788
- case dialog.run
789
- when Gtk::Dialog::RESPONSE_ACCEPT
790
- filename = dialog.filename
791
- else
792
- filename = nil
793
- end
794
- dialog.destroy
795
- end
778
+ dialog = Gtk::FileChooserDialog.new(
779
+ title,
780
+ nil,
781
+ action,
782
+ nil,
783
+ [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
784
+ [ok_button, Gtk::Dialog::RESPONSE_ACCEPT])
796
785
 
797
- if filename.nil? then
798
- return
786
+ filter_all = Gtk::FileFilter.new
787
+ filter_all.name = "All Files"
788
+ filter_all.add_pattern "*"
789
+
790
+ filter_jota = Gtk::FileFilter.new
791
+ filter_jota.name = "Jota Files"
792
+ filter_jota.add_pattern "*.jota"
793
+
794
+ # first added filter is default
795
+ dialog.add_filter filter_jota
796
+ dialog.add_filter filter_all
797
+
798
+ dialog.current_name = "Untitled.jota" if mode == :save
799
+
800
+ case dialog.run
801
+ when Gtk::Dialog::RESPONSE_ACCEPT
802
+ filename = dialog.filename
803
+ else
804
+ filename = nil
799
805
  end
806
+ dialog.destroy
800
807
 
801
808
  return filename
802
809
  end
803
810
 
811
+ def show
812
+ clip_to_widget(@clip_widget,@data)
813
+ set_buttons
814
+ set_title
815
+ end
816
+
804
817
  def update
805
818
  widget_to_clip(@clip_widget, @data) if @data
806
819
  set_buttons
@@ -809,10 +822,14 @@ end
809
822
 
810
823
  def autosave
811
824
  # do autosave if enabled and due
812
- if @data and pref("autosave_enable") and Time.now >= @next_autosave then
825
+ if @data &&
826
+ @changed &&
827
+ pref("autosave_enable") &&
828
+ Time.now >= @next_autosave then
813
829
  print_verbose "autosaving at #{Time.now}"
814
830
  @data.save
815
831
  set_autosave
832
+ @changed = false
816
833
  end
817
834
  end
818
835
 
data/lib/jota.glade CHANGED
@@ -5,8 +5,6 @@
5
5
  <widget class="GtkWindow" id="top">
6
6
  <property name="visible">True</property>
7
7
  <property name="title" translatable="yes">jota</property>
8
- <property name="default_width">740</property>
9
- <property name="default_height">280</property>
10
8
  <signal name="destroy" handler="on_top_destroy"/>
11
9
  <signal name="delete_event" handler="on_top_delete"/>
12
10
  <child>
@@ -161,6 +159,8 @@
161
159
  <widget class="GtkTextView" id="clip">
162
160
  <property name="visible">True</property>
163
161
  <property name="can_focus">True</property>
162
+ <signal name="button_press_event" handler="on_clip_button_press_event"/>
163
+ <signal name="key_press_event" handler="on_clip_key_press_event"/>
164
164
  </widget>
165
165
  </child>
166
166
  </widget>
@@ -679,65 +679,6 @@ The following special characters are possible in filename:
679
679
  <property name="visible">True</property>
680
680
  </widget>
681
681
  </child>
682
- <child>
683
- <widget class="GtkMenuItem" id="menu_export">
684
- <property name="visible">True</property>
685
- <property name="label" translatable="yes">_Export</property>
686
- <property name="use_underline">True</property>
687
- <child>
688
- <widget class="GtkMenu" id="menu_export_menu">
689
- <child>
690
- <widget class="GtkMenuItem" id="menu_export_mbox">
691
- <property name="visible">True</property>
692
- <property name="label" translatable="yes">_Mbox</property>
693
- <property name="use_underline">True</property>
694
- <signal name="activate" handler="on_menu_export_mbox_activate"/>
695
- </widget>
696
- </child>
697
- <child>
698
- <widget class="GtkMenuItem" id="menu_export_yaml">
699
- <property name="visible">True</property>
700
- <property name="label" translatable="yes">_Yaml</property>
701
- <property name="use_underline">True</property>
702
- <signal name="activate" handler="on_menu_export_yaml_activate"/>
703
- </widget>
704
- </child>
705
- </widget>
706
- </child>
707
- </widget>
708
- </child>
709
- <child>
710
- <widget class="GtkMenuItem" id="menu_import">
711
- <property name="visible">True</property>
712
- <property name="label" translatable="yes">_Import</property>
713
- <property name="use_underline">True</property>
714
- <child>
715
- <widget class="GtkMenu" id="menu_import_menu">
716
- <child>
717
- <widget class="GtkMenuItem" id="menu_import_mbox">
718
- <property name="visible">True</property>
719
- <property name="label" translatable="yes">_Mbox</property>
720
- <property name="use_underline">True</property>
721
- <signal name="activate" handler="on_menu_import_mbox_activate"/>
722
- </widget>
723
- </child>
724
- <child>
725
- <widget class="GtkMenuItem" id="menu_import_yaml">
726
- <property name="visible">True</property>
727
- <property name="label" translatable="yes">_Yaml</property>
728
- <property name="use_underline">True</property>
729
- <signal name="activate" handler="on_menu_import_yaml_activate"/>
730
- </widget>
731
- </child>
732
- </widget>
733
- </child>
734
- </widget>
735
- </child>
736
- <child>
737
- <widget class="GtkSeparatorMenuItem" id="separator6">
738
- <property name="visible">True</property>
739
- </widget>
740
- </child>
741
682
  <child>
742
683
  <widget class="GtkImageMenuItem" id="menu_preferences">
743
684
  <property name="label">gtk-preferences</property>
@@ -747,11 +688,6 @@ The following special characters are possible in filename:
747
688
  <signal name="activate" handler="on_menu_preferences_activate"/>
748
689
  </widget>
749
690
  </child>
750
- <child>
751
- <widget class="GtkSeparatorMenuItem" id="separator7">
752
- <property name="visible">True</property>
753
- </widget>
754
- </child>
755
691
  <child>
756
692
  <widget class="GtkImageMenuItem" id="menu_about">
757
693
  <property name="label">gtk-about</property>
data/lib/jota.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # $Id: jota.rb 270 2010-06-02 16:00:02Z dz $
3
+ # $Id: jota.rb 276 2010-08-03 12:39:39Z dz $
4
4
 
5
5
 
6
6
  require 'getoptlong'
@@ -39,24 +39,27 @@ def usage
39
39
  puts_version(false)
40
40
 
41
41
  puts
42
- puts("usage: #{$0} 'options' 'file' [ 'regular-expression' ]")
42
+ puts("usage: #{File.basename $0} 'options' 'file' [ 'regexp' ]")
43
43
  puts
44
44
  puts("MODES")
45
- puts("\t--text or -t\t\t\tforce text mode")
46
- puts("\t--gui or -g\t\t\tforce graphical mode")
45
+ puts("\t--text or -t\t\tforce text mode")
46
+ puts("\t--gui or -g\t\tforce graphical mode")
47
47
  puts
48
48
  puts("IMMEDIATE MODE")
49
- puts("\t--create or -C\t\t\tcreate a new clip from stdin ('regexp' ignored)")
50
- puts("\t--retrieve or -R\t\twrite clip to stdout ('regexp' required)")
51
- puts("\t--update or -U \t\t\tchange clip from stdin ('regexp' required)")
52
- puts("\t--delete or -D \t\t\tdelete a clip ('regexp' required)")
53
- puts("\t--list or -L\t\t\tlist all clips ('regexp' ignored)")
49
+ puts("\t--create or -C\t\tcreate a new clip from stdin ('regexp' ignored)")
50
+ puts("\t--retrieve or -R\twrite clip to stdout ('regexp' required)")
51
+ puts("\t--update or -U \t\tchange clip from stdin ('regexp' required)")
52
+ puts("\t--delete or -D \t\tdelete a clip ('regexp' required)")
53
+ puts("\t--list or -L\t\tlist all clips ('regexp' ignored)")
54
+ puts
55
+ puts("GUI MODE")
56
+ puts("\t--size 'WxH' or -s\tset window width and height to W and H")
54
57
  puts
55
58
  puts("HELPING")
56
- puts("\t--help or -h\t\t\tthis help")
57
- puts("\t--version or -V\t\t\tshow version")
58
- puts("\t--verbose or -v\t\t\tset verbose mode, -vv is more verbose ")
59
- puts("\t--logfile or -f 'file'\t\twrite verbose output to 'file'")
59
+ puts("\t--help or -h\t\tthis help")
60
+ puts("\t--version or -V\t\tshow version")
61
+ puts("\t--verbose or -v\t\tset verbose mode, -vv is more verbose ")
62
+ puts("\t--logfile or -f 'file'\twrite verbose output to 'file'")
60
63
  end
61
64
 
62
65
  def error(msg)
@@ -67,22 +70,24 @@ end
67
70
 
68
71
  def parse_args
69
72
  opts = GetoptLong.new(
70
- [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
71
- [ '--logfile', '-f', GetoptLong::REQUIRED_ARGUMENT ],
72
- [ '--text', '-t', GetoptLong::NO_ARGUMENT ],
73
- [ '--gui', '-g', GetoptLong::NO_ARGUMENT ],
74
- [ '--create', '-C', GetoptLong::NO_ARGUMENT ],
75
- [ '--retrieve', '-R', GetoptLong::NO_ARGUMENT ],
76
- [ '--update', '-U', GetoptLong::NO_ARGUMENT ],
77
- [ '--delete', '-D', GetoptLong::NO_ARGUMENT ],
78
- [ '--list', '-L', GetoptLong::NO_ARGUMENT ],
79
- [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
80
- [ '--version', '-V', GetoptLong::NO_ARGUMENT ]
73
+ [ '--create', '-C', GetoptLong::NO_ARGUMENT ],
74
+ [ '--delete', '-D', GetoptLong::NO_ARGUMENT ],
75
+ [ '--gui', '-g', GetoptLong::NO_ARGUMENT ],
76
+ [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
77
+ [ '--list', '-L', GetoptLong::NO_ARGUMENT ],
78
+ [ '--logfile', '-f', GetoptLong::REQUIRED_ARGUMENT ],
79
+ [ '--retrieve', '-R', GetoptLong::NO_ARGUMENT ],
80
+ [ '--text', '-t', GetoptLong::NO_ARGUMENT ],
81
+ [ '--update', '-U', GetoptLong::NO_ARGUMENT ],
82
+ [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
83
+ [ '--size', '-s', GetoptLong::REQUIRED_ARGUMENT ],
84
+ [ '--version', '-V', GetoptLong::NO_ARGUMENT ]
81
85
  )
82
86
 
83
87
  @force = nil
84
88
  $debug_filename = nil
85
89
  $debug_file = nil
90
+ @size = nil
86
91
 
87
92
  begin
88
93
  opts.each do |opt, arg|
@@ -119,6 +124,8 @@ def parse_args
119
124
  when '--list'
120
125
  @force = :immediate
121
126
  @immediate_cmd = :list
127
+ when '--size'
128
+ @size = arg
122
129
  else
123
130
  error("Illegal argument '#{opt}'")
124
131
  end
@@ -149,7 +156,7 @@ def parse_args
149
156
  print_verbose "logfile set to '#{$debug_filename}'" if $VERBOSE and $debug_filename
150
157
  print_verbose "filename set to '#{@filename}'"
151
158
  print_verbose "regexp set to '#{@regexp}'"
152
- print_verbose "forcing #{@force.to_s} mode"
159
+ print_verbose "forcing #{@force.to_s} mode" if @force
153
160
  print_verbose "using immediate command :#{@immediate_cmd.to_s}" if @force == :immediate
154
161
  end
155
162
  end
@@ -189,7 +196,16 @@ def start_gui
189
196
  end
190
197
  end
191
198
 
192
- glade.create_gui
199
+ width = height = nil
200
+ if @size then
201
+ md = /^(\d+)[xX*](\d+)$/.match @size
202
+ if md then
203
+ width = md[1].to_i
204
+ height = md[2].to_i
205
+ end
206
+ end
207
+
208
+ glade.create_gui width, height
193
209
 
194
210
  print_verbose "entering main loop"
195
211
 
data/lib/preferences.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: preferences.rb 249 2010-04-14 15:56:22Z dz $
2
+ # $Id: preferences.rb 276 2010-08-03 12:39:39Z dz $
3
3
 
4
4
  require 'yaml'
5
5
  require 'version'
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: version.rb 270 2010-06-02 16:00:02Z dz $
2
+ # $Id: version.rb 272 2010-07-31 13:32:37Z dz $
3
3
 
4
4
 
5
5
  class Version
@@ -29,7 +29,7 @@ MAJOR = 0
29
29
  MINOR = 9
30
30
  PATCH = 0
31
31
  STATE = "dev" # "dev", "beta", "rc", "" (for final)
32
- STATEVER = 2
32
+ STATEVER = 3
33
33
 
34
34
  STRING = "%d.%d.%d%s" % [MAJOR, MINOR,PATCH,Version.state]
35
35
 
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jota
3
3
  version: !ruby/object:Gem::Version
4
- hash: 470221478
5
- prerelease: true
6
- segments:
7
- - 0
8
- - 9
9
- - 0dev2
10
- version: 0.9.0dev2
4
+ version: 0.9.0dev3
11
5
  platform: ruby
12
6
  authors:
13
7
  - Derik van Zuetphen
@@ -15,7 +9,7 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2010-07-30 11:28:16 +02:00
12
+ date: 2010-08-03 14:39:49 +02:00
19
13
  default_executable:
20
14
  dependencies: []
21
15
 
@@ -23,6 +17,7 @@ description: ""
23
17
  email: dz@426.ch
24
18
  executables:
25
19
  - jota
20
+ - jota.bat
26
21
  extensions: []
27
22
 
28
23
  extra_rdoc_files:
@@ -58,29 +53,21 @@ rdoc_options: []
58
53
  require_paths:
59
54
  - lib
60
55
  required_ruby_version: !ruby/object:Gem::Requirement
61
- none: false
62
56
  requirements:
63
57
  - - ">="
64
58
  - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
67
- - 0
68
59
  version: "0"
60
+ version:
69
61
  required_rubygems_version: !ruby/object:Gem::Requirement
70
- none: false
71
62
  requirements:
72
63
  - - ">"
73
64
  - !ruby/object:Gem::Version
74
- hash: 25
75
- segments:
76
- - 1
77
- - 3
78
- - 1
79
65
  version: 1.3.1
66
+ version:
80
67
  requirements: []
81
68
 
82
69
  rubyforge_project: jota
83
- rubygems_version: 1.3.7
70
+ rubygems_version: 1.3.5
84
71
  signing_key:
85
72
  specification_version: 3
86
73
  summary: A simple but powerful jotter in the style of xclipboard