/[freeride]/freeride/plugins/rubyide_fox_gui/fox_services.rb
ViewVC logotype

Diff of /freeride/plugins/rubyide_fox_gui/fox_services.rb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by richkilmer, Fri Dec 20 17:27:31 2002 UTC revision 1.2 by ljulliar, Tue May 13 18:12:54 2003 UTC
# Line 56  module FreeRIDE Line 56  module FreeRIDE
56              mainWindow,              mainWindow,
57              MBOX_YES_NO_CANCEL,              MBOX_YES_NO_CANCEL,
58              "Unsaved Document",              "Unsaved Document",
59              "Do you want to save the changes\nyou made to #{File.basename(filename)}?"              "Do you want to save the changes\nyou made to #{File.basename(filename)}?".wrap(60)
60            )            )
61                        
62            result = case answer            result = case answer
# Line 93  module FreeRIDE Line 93  module FreeRIDE
93            result            result
94          end          end
95                    
96          cmd_mgr.add("App/Services/YesNoCancelDialog", "Yes/No Dialog Box") do |cmd_slot, title, msg|          cmd_mgr.add("App/Services/YesNoCancelDialog", "Yes/No/Cancel Dialog Box") do |cmd_slot, title, msg|
97            mainWindow = plugin["/system/ui/fox/FXMainWindow"].data            mainWindow = plugin["/system/ui/fox/FXMainWindow"].data
98            case FXMessageBox.information(mainWindow, MBOX_YES_NO_CANCEL, title, msg)            case FXMessageBox.information(mainWindow, MBOX_YES_NO_CANCEL, title, msg.wrap(60))
99            when MBOX_CLICKED_YES            when MBOX_CLICKED_YES
100              "yes"              "yes"
101            when MBOX_CLICKED_NO            when MBOX_CLICKED_NO
# Line 107  module FreeRIDE Line 107  module FreeRIDE
107                    
108          cmd_mgr.add("App/Services/YesNoDialog", "Yes/No Dialog Box") do |cmd_slot, title, msg|          cmd_mgr.add("App/Services/YesNoDialog", "Yes/No Dialog Box") do |cmd_slot, title, msg|
109            mainWindow = plugin["/system/ui/fox/FXMainWindow"].data            mainWindow = plugin["/system/ui/fox/FXMainWindow"].data
110            case FXMessageBox.information(mainWindow, MBOX_YES_NO, title, msg)            case FXMessageBox.information(mainWindow, MBOX_YES_NO, title, msg.wrap(60))
111            when MBOX_CLICKED_YES            when MBOX_CLICKED_YES
112              "yes"              "yes"
113            when MBOX_CLICKED_NO            when MBOX_CLICKED_NO
# Line 117  module FreeRIDE Line 117  module FreeRIDE
117                    
118          cmd_mgr.add("App/Services/MessageBox", "Display MessageBox") do |cmd_slot, title, msg|          cmd_mgr.add("App/Services/MessageBox", "Display MessageBox") do |cmd_slot, title, msg|
119            mainWindow = plugin["/system/ui/fox/FXMainWindow"].data            mainWindow = plugin["/system/ui/fox/FXMainWindow"].data
120            FXMessageBox.information(mainWindow, MBOX_OK, title, msg)            FXMessageBox.information(mainWindow, MBOX_OK, title, msg.wrap(60))
121          end          end
122                    
123          cmd_mgr.add("App/Services/Shutdown", "Shutdown Freeride") do |cmd_slot|          cmd_mgr.add("App/Services/Shutdown", "Shutdown Freeride") do |cmd_slot|
# Line 135  module FreeRIDE Line 135  module FreeRIDE
135            
136    end    end
137  end  end
138    
139    
140    ##
141    # Add a new wrap method to string which wrap long message
142    # to max_size character per line
143    #
144    class String
145      def wrap(max_size)
146        all = []
147        line = nil
148        str = self.dup
149        while (line = str.slice!(/.{#{max_size}}/))
150          all.push(line)
151        end
152        all.push(str).join("\n")
153      end
154    end

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26