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 |
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 |
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 |
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| |
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 |