[1] | 1 | #include "save_details_widget.h" |
---|
| 2 | #include "mapstorage.h" |
---|
| 3 | |
---|
| 4 | SaveDetailsWidget::SaveDetailsWidget(MapStorage* ms) : |
---|
| 5 | pMapStorage(ms) |
---|
| 6 | { |
---|
| 7 | Gtk::Notebook* nb = Gtk::manage(new Gtk::Notebook); |
---|
| 8 | pack_start(*nb, Gtk::PACK_EXPAND_WIDGET); |
---|
| 9 | |
---|
| 10 | nb->set_tab_pos(Gtk::POS_TOP); |
---|
| 11 | |
---|
| 12 | Gtk::VBox* vblueMaps = Gtk::manage(new Gtk::VBox(false, 18)); |
---|
| 13 | vblueMaps->set_border_width(12); |
---|
| 14 | |
---|
| 15 | Gtk::VBox* vbArcMaps = Gtk::manage(new Gtk::VBox(false, 18)); |
---|
| 16 | vbArcMaps->set_border_width(12); |
---|
| 17 | |
---|
| 18 | Gtk::VBox* vbSpecMaps = Gtk::manage(new Gtk::VBox(false, 18)); |
---|
| 19 | vbSpecMaps->set_border_width(12); |
---|
| 20 | |
---|
| 21 | Gtk::VBox* vbGuiSect = Gtk::manage(new Gtk::VBox(false, 18)); |
---|
| 22 | vbGuiSect->set_border_width(12); |
---|
| 23 | |
---|
| 24 | nb->append_page(*vbSpecMaps, "Special Maps"); |
---|
| 25 | nb->append_page(*vblueMaps, "Node Maps"); |
---|
| 26 | nb->append_page(*vbArcMaps, "Arc Maps"); |
---|
| 27 | nb->append_page(*vbGuiSect, "GUI Section"); |
---|
| 28 | |
---|
| 29 | // child widgets of vbSpecMaps |
---|
| 30 | |
---|
| 31 | { |
---|
| 32 | Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6)); |
---|
| 33 | vbSpecMaps->pack_start(*box1, Gtk::PACK_SHRINK); |
---|
| 34 | |
---|
| 35 | Gtk::Label* lblNodeCoordMap = |
---|
| 36 | Gtk::manage(new Gtk::Label("<b>Node Coordinates</b>")); |
---|
| 37 | lblNodeCoordMap->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); |
---|
| 38 | lblNodeCoordMap->set_use_markup(); |
---|
| 39 | box1->pack_start(*lblNodeCoordMap, Gtk::PACK_SHRINK); |
---|
| 40 | |
---|
| 41 | Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox); |
---|
| 42 | box1->pack_start(*box2, Gtk::PACK_SHRINK); |
---|
| 43 | |
---|
| 44 | Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 45 | box2->pack_start(*fill1, Gtk::PACK_SHRINK); |
---|
| 46 | |
---|
| 47 | Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox); |
---|
| 48 | box2->pack_start(*box3, Gtk::PACK_SHRINK); |
---|
| 49 | |
---|
| 50 | rblueCoordGuiSection.set_label("Save to GUI section"); |
---|
| 51 | rblueCoordNodesetSection.set_label("Save to Nodeset section"); |
---|
| 52 | Gtk::RadioButtonGroup group = rblueCoordGuiSection.get_group(); |
---|
| 53 | rblueCoordNodesetSection.set_group(group); |
---|
| 54 | |
---|
| 55 | box3->pack_start(rblueCoordGuiSection, Gtk::PACK_SHRINK); |
---|
| 56 | box3->pack_start(rblueCoordNodesetSection, Gtk::PACK_SHRINK); |
---|
| 57 | |
---|
| 58 | Gtk::HBox* box4 = Gtk::manage(new Gtk::HBox); |
---|
| 59 | box3->pack_start(*box4, Gtk::PACK_SHRINK); |
---|
| 60 | |
---|
| 61 | Gtk::Label* fill2 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 62 | box4->pack_start(*fill2, Gtk::PACK_SHRINK); |
---|
| 63 | |
---|
| 64 | Gtk::Table* table1 = Gtk::manage(new Gtk::Table(3, 2)); |
---|
| 65 | box4->pack_start(*table1, Gtk::PACK_SHRINK); |
---|
| 66 | |
---|
| 67 | rblueCoordOneMap.set_label("As one map"); |
---|
| 68 | rblueCoordTwoMaps.set_label("As two maps"); |
---|
| 69 | group = rblueCoordOneMap.get_group(); |
---|
| 70 | rblueCoordTwoMaps.set_group(group); |
---|
| 71 | |
---|
| 72 | table1->attach(rblueCoordOneMap, 0, 1, 0, 1); |
---|
| 73 | table1->attach(rblueCoordTwoMaps, 0, 1, 1, 2); |
---|
| 74 | table1->attach(entNodeCoordsOneMap, 1, 2, 0, 1); |
---|
| 75 | table1->attach(entNodeCoordsTwoMaps1, 1, 2, 1, 2); |
---|
| 76 | table1->attach(entNodeCoordsTwoMaps2, 1, 2, 2, 3); |
---|
| 77 | |
---|
| 78 | switch (pMapStorage->getNodeCoordsSaveDest()) |
---|
| 79 | { |
---|
| 80 | case MapStorage::SpecMapSaveOpts::GUI_SECT: |
---|
| 81 | rblueCoordGuiSection.set_active(); |
---|
| 82 | rblueCoordOneMap.set_sensitive(false); |
---|
| 83 | rblueCoordTwoMaps.set_sensitive(false); |
---|
| 84 | entNodeCoordsOneMap.set_sensitive(false); |
---|
| 85 | entNodeCoordsTwoMaps1.set_sensitive(false); |
---|
| 86 | entNodeCoordsTwoMaps2.set_sensitive(false); |
---|
| 87 | break; |
---|
| 88 | case MapStorage::SpecMapSaveOpts::NESET_SECT: |
---|
| 89 | rblueCoordNodesetSection.set_active(); |
---|
| 90 | rblueCoordOneMap.set_sensitive(true); |
---|
| 91 | rblueCoordTwoMaps.set_sensitive(true); |
---|
| 92 | switch (pMapStorage->getNodeCoordsSaveMapNum()) |
---|
| 93 | { |
---|
| 94 | case MapStorage::SpecMapSaveOpts::ONE_MAP: |
---|
| 95 | rblueCoordOneMap.set_active(); |
---|
| 96 | entNodeCoordsOneMap.set_sensitive(true); |
---|
| 97 | entNodeCoordsTwoMaps1.set_sensitive(false); |
---|
| 98 | entNodeCoordsTwoMaps2.set_sensitive(false); |
---|
| 99 | break; |
---|
| 100 | case MapStorage::SpecMapSaveOpts::TWO_MAPS: |
---|
| 101 | rblueCoordTwoMaps.set_active(); |
---|
| 102 | entNodeCoordsOneMap.set_sensitive(false); |
---|
| 103 | entNodeCoordsTwoMaps1.set_sensitive(true); |
---|
| 104 | entNodeCoordsTwoMaps2.set_sensitive(true); |
---|
| 105 | break; |
---|
| 106 | } |
---|
| 107 | break; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | entNodeCoordsOneMap.set_text(pMapStorage->getNodeCoordsOneMapName()); |
---|
| 111 | entNodeCoordsTwoMaps1.set_text(pMapStorage->getNodeCoordsTwoMaps1Name()); |
---|
| 112 | entNodeCoordsTwoMaps2.set_text(pMapStorage->getNodeCoordsTwoMaps2Name()); |
---|
| 113 | |
---|
| 114 | entNodeCoordsOneMap.signal_changed().connect( |
---|
| 115 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordsOneMapName)); |
---|
| 116 | entNodeCoordsTwoMaps1.signal_changed().connect( |
---|
| 117 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordsTwoMaps1Name)); |
---|
| 118 | entNodeCoordsTwoMaps2.signal_changed().connect( |
---|
| 119 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordsTwoMaps2Name)); |
---|
| 120 | |
---|
| 121 | rblueCoordGuiSection.signal_toggled().connect( |
---|
| 122 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordSaveDestChanged)); |
---|
| 123 | rblueCoordNodesetSection.signal_toggled().connect( |
---|
| 124 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordSaveDestChanged)); |
---|
| 125 | rblueCoordOneMap.signal_toggled().connect( |
---|
| 126 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordMapNumChanged)); |
---|
| 127 | rblueCoordTwoMaps.signal_toggled().connect( |
---|
| 128 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeCoordMapNumChanged)); |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | { |
---|
| 132 | Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6)); |
---|
| 133 | vbSpecMaps->pack_start(*box1, Gtk::PACK_SHRINK); |
---|
| 134 | |
---|
| 135 | Gtk::Label* lblArrowCoordMap = |
---|
| 136 | Gtk::manage(new Gtk::Label("<b>Arrow Coordinates</b>")); |
---|
| 137 | lblArrowCoordMap->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); |
---|
| 138 | lblArrowCoordMap->set_use_markup(); |
---|
| 139 | box1->pack_start(*lblArrowCoordMap, Gtk::PACK_SHRINK); |
---|
| 140 | |
---|
| 141 | Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox); |
---|
| 142 | box1->pack_start(*box2, Gtk::PACK_SHRINK); |
---|
| 143 | |
---|
| 144 | Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 145 | box2->pack_start(*fill1, Gtk::PACK_SHRINK); |
---|
| 146 | |
---|
| 147 | Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox); |
---|
| 148 | box2->pack_start(*box3, Gtk::PACK_SHRINK); |
---|
| 149 | |
---|
| 150 | rbArrowCoordGuiSection.set_label("Save to GUI section"); |
---|
| 151 | rbArrowCoordArcsetSection.set_label("Save to Arcset section"); |
---|
| 152 | Gtk::RadioButtonGroup group = rbArrowCoordGuiSection.get_group(); |
---|
| 153 | rbArrowCoordArcsetSection.set_group(group); |
---|
| 154 | |
---|
| 155 | box3->pack_start(rbArrowCoordGuiSection, Gtk::PACK_SHRINK); |
---|
| 156 | box3->pack_start(rbArrowCoordArcsetSection, Gtk::PACK_SHRINK); |
---|
| 157 | |
---|
| 158 | Gtk::HBox* box4 = Gtk::manage(new Gtk::HBox); |
---|
| 159 | box3->pack_start(*box4, Gtk::PACK_SHRINK); |
---|
| 160 | |
---|
| 161 | Gtk::Label* fill2 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 162 | box4->pack_start(*fill2, Gtk::PACK_SHRINK); |
---|
| 163 | |
---|
| 164 | Gtk::Table* table1 = Gtk::manage(new Gtk::Table(3, 2)); |
---|
| 165 | box4->pack_start(*table1, Gtk::PACK_SHRINK); |
---|
| 166 | |
---|
| 167 | rbArrowCoordOneMap.set_label("As one map"); |
---|
| 168 | rbArrowCoordTwoMaps.set_label("As two maps"); |
---|
| 169 | group = rbArrowCoordOneMap.get_group(); |
---|
| 170 | rbArrowCoordTwoMaps.set_group(group); |
---|
| 171 | |
---|
| 172 | table1->attach(rbArrowCoordOneMap, 0, 1, 0, 1); |
---|
| 173 | table1->attach(rbArrowCoordTwoMaps, 0, 1, 1, 2); |
---|
| 174 | table1->attach(entArrowCoordsOneMap, 1, 2, 0, 1); |
---|
| 175 | table1->attach(entArrowCoordsTwoMaps1, 1, 2, 1, 2); |
---|
| 176 | table1->attach(entArrowCoordsTwoMaps2, 1, 2, 2, 3); |
---|
| 177 | |
---|
| 178 | switch (pMapStorage->getArrowCoordsSaveDest()) |
---|
| 179 | { |
---|
| 180 | case MapStorage::SpecMapSaveOpts::GUI_SECT: |
---|
| 181 | rbArrowCoordGuiSection.set_active(); |
---|
| 182 | rbArrowCoordOneMap.set_sensitive(false); |
---|
| 183 | rbArrowCoordTwoMaps.set_sensitive(false); |
---|
| 184 | entArrowCoordsOneMap.set_sensitive(false); |
---|
| 185 | entArrowCoordsTwoMaps1.set_sensitive(false); |
---|
| 186 | entArrowCoordsTwoMaps2.set_sensitive(false); |
---|
| 187 | break; |
---|
| 188 | case MapStorage::SpecMapSaveOpts::NESET_SECT: |
---|
| 189 | rbArrowCoordArcsetSection.set_active(); |
---|
| 190 | rbArrowCoordOneMap.set_sensitive(true); |
---|
| 191 | rbArrowCoordTwoMaps.set_sensitive(true); |
---|
| 192 | switch (pMapStorage->getArrowCoordsSaveMapNum()) |
---|
| 193 | { |
---|
| 194 | case MapStorage::SpecMapSaveOpts::ONE_MAP: |
---|
| 195 | rbArrowCoordOneMap.set_active(); |
---|
| 196 | entArrowCoordsOneMap.set_sensitive(true); |
---|
| 197 | entArrowCoordsTwoMaps1.set_sensitive(false); |
---|
| 198 | entArrowCoordsTwoMaps2.set_sensitive(false); |
---|
| 199 | break; |
---|
| 200 | case MapStorage::SpecMapSaveOpts::TWO_MAPS: |
---|
| 201 | rbArrowCoordTwoMaps.set_active(); |
---|
| 202 | entArrowCoordsOneMap.set_sensitive(false); |
---|
| 203 | entArrowCoordsTwoMaps1.set_sensitive(true); |
---|
| 204 | entArrowCoordsTwoMaps2.set_sensitive(true); |
---|
| 205 | break; |
---|
| 206 | } |
---|
| 207 | break; |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | entArrowCoordsOneMap.set_text(pMapStorage->getArrowCoordsOneMapName()); |
---|
| 211 | entArrowCoordsTwoMaps1.set_text(pMapStorage->getArrowCoordsTwoMaps1Name()); |
---|
| 212 | entArrowCoordsTwoMaps2.set_text(pMapStorage->getArrowCoordsTwoMaps2Name()); |
---|
| 213 | |
---|
| 214 | entArrowCoordsOneMap.signal_changed().connect( |
---|
| 215 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordsOneMapName)); |
---|
| 216 | entArrowCoordsTwoMaps1.signal_changed().connect( |
---|
| 217 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordsTwoMaps1Name)); |
---|
| 218 | entArrowCoordsTwoMaps2.signal_changed().connect( |
---|
| 219 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordsTwoMaps2Name)); |
---|
| 220 | |
---|
| 221 | rbArrowCoordGuiSection.signal_toggled().connect( |
---|
| 222 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordSaveDestChanged)); |
---|
| 223 | rbArrowCoordArcsetSection.signal_toggled().connect( |
---|
| 224 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordSaveDestChanged)); |
---|
| 225 | rbArrowCoordOneMap.signal_toggled().connect( |
---|
| 226 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordMapNumChanged)); |
---|
| 227 | rbArrowCoordTwoMaps.signal_toggled().connect( |
---|
| 228 | sigc::mem_fun(*this, &SaveDetailsWidget::onArrowCoordMapNumChanged)); |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | // child widgets of vbGuiSect |
---|
| 232 | |
---|
| 233 | { |
---|
| 234 | Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6)); |
---|
| 235 | vbGuiSect->pack_start(*box1, Gtk::PACK_SHRINK); |
---|
| 236 | |
---|
| 237 | Gtk::Label* lblGuiSectionSave = |
---|
| 238 | Gtk::manage(new Gtk::Label("<b>Save Destination</b>")); |
---|
| 239 | lblGuiSectionSave->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); |
---|
| 240 | lblGuiSectionSave->set_use_markup(); |
---|
| 241 | box1->pack_start(*lblGuiSectionSave, Gtk::PACK_SHRINK); |
---|
| 242 | |
---|
| 243 | rbLgfFile.set_label("Lgf file"); |
---|
| 244 | rbConfFile.set_label("Conf file"); |
---|
| 245 | |
---|
| 246 | Gtk::RadioButtonGroup group = rbLgfFile.get_group(); |
---|
| 247 | rbConfFile.set_group(group); |
---|
| 248 | |
---|
| 249 | switch (pMapStorage->getGUIDataSaveLocation()) |
---|
| 250 | { |
---|
| 251 | case MapStorage::LGF_FILE: |
---|
| 252 | rbLgfFile.set_active(); |
---|
| 253 | break; |
---|
| 254 | case MapStorage::CONF_FILE: |
---|
| 255 | rbConfFile.set_active(); |
---|
| 256 | break; |
---|
| 257 | } |
---|
| 258 | |
---|
| 259 | Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox); |
---|
| 260 | box1->pack_start(*box2, Gtk::PACK_SHRINK); |
---|
| 261 | |
---|
| 262 | Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 263 | box2->pack_start(*fill1, Gtk::PACK_SHRINK); |
---|
| 264 | |
---|
| 265 | Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox); |
---|
| 266 | box2->pack_start(*box3, Gtk::PACK_SHRINK); |
---|
| 267 | |
---|
| 268 | box3->pack_start(rbLgfFile, Gtk::PACK_SHRINK); |
---|
| 269 | box3->pack_start(rbConfFile, Gtk::PACK_SHRINK); |
---|
| 270 | |
---|
| 271 | rbLgfFile.signal_toggled().connect( |
---|
| 272 | sigc::mem_fun(*this, &SaveDetailsWidget::onGuiSectSaveDestChanged)); |
---|
| 273 | rbConfFile.signal_toggled().connect( |
---|
| 274 | sigc::mem_fun(*this, &SaveDetailsWidget::onGuiSectSaveDestChanged)); |
---|
| 275 | } |
---|
| 276 | |
---|
| 277 | // child widgets of vblueMaps |
---|
| 278 | |
---|
| 279 | { |
---|
| 280 | Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6)); |
---|
| 281 | vblueMaps->pack_start(*box1, Gtk::PACK_SHRINK); |
---|
| 282 | |
---|
| 283 | Gtk::Label* label1 = |
---|
| 284 | Gtk::manage(new Gtk::Label("<b>Save Destination</b>")); |
---|
| 285 | label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); |
---|
| 286 | label1->set_use_markup(); |
---|
| 287 | box1->pack_start(*label1, Gtk::PACK_SHRINK); |
---|
| 288 | |
---|
| 289 | Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox); |
---|
| 290 | box1->pack_start(*box2, Gtk::PACK_SHRINK); |
---|
| 291 | |
---|
| 292 | Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 293 | box2->pack_start(*fill1, Gtk::PACK_SHRINK); |
---|
| 294 | |
---|
| 295 | Gtk::Frame* frame = Gtk::manage(new Gtk::Frame); |
---|
| 296 | box2->pack_start(*frame, Gtk::PACK_EXPAND_WIDGET); |
---|
| 297 | |
---|
| 298 | Gtk::ScrolledWindow* swNodeMaps = Gtk::manage(new Gtk::ScrolledWindow); |
---|
| 299 | frame->add(*swNodeMaps); |
---|
| 300 | |
---|
| 301 | swNodeMaps->add(twNodeMaps); |
---|
| 302 | |
---|
| 303 | refNodeMapStore = Gtk::ListStore::create(NodeMapColumns); |
---|
| 304 | |
---|
| 305 | std::vector<std::string> node_maps = pMapStorage->getNodeMapList(); |
---|
| 306 | for (std::vector<std::string>::const_iterator it = node_maps.begin(); |
---|
| 307 | it != node_maps.end(); ++it) |
---|
| 308 | { |
---|
| 309 | Gtk::TreeModel::Row row = *(refNodeMapStore->append()); |
---|
| 310 | row[NodeMapColumns.colName] = *it; |
---|
| 311 | switch (pMapStorage->getNodeMapSaveDest(*it)) |
---|
| 312 | { |
---|
| 313 | case MapStorage::GUI_SECT: |
---|
| 314 | row[NodeMapColumns.colSaveToMainSect] = false; |
---|
| 315 | row[NodeMapColumns.colSaveToGuiSect] = true; |
---|
| 316 | break; |
---|
| 317 | case MapStorage::NESET_SECT: |
---|
| 318 | row[NodeMapColumns.colSaveToMainSect] = true; |
---|
| 319 | row[NodeMapColumns.colSaveToGuiSect] = false; |
---|
| 320 | break; |
---|
| 321 | case MapStorage::DONT_SAVE: |
---|
| 322 | row[NodeMapColumns.colSaveToMainSect] = false; |
---|
| 323 | row[NodeMapColumns.colSaveToGuiSect] = false; |
---|
| 324 | break; |
---|
| 325 | } |
---|
| 326 | } |
---|
| 327 | |
---|
| 328 | twNodeMaps.set_model(refNodeMapStore); |
---|
| 329 | twNodeMaps.append_column("Name", NodeMapColumns.colName); |
---|
| 330 | twNodeMaps.append_column_editable("Nodeset section", |
---|
| 331 | NodeMapColumns.colSaveToMainSect); |
---|
| 332 | twNodeMaps.append_column_editable("GUI section", |
---|
| 333 | NodeMapColumns.colSaveToGuiSect); |
---|
| 334 | |
---|
| 335 | swNodeMaps->set_size_request(-1, 200); |
---|
| 336 | swNodeMaps->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
---|
| 337 | |
---|
| 338 | refNodeMapStore->signal_row_changed().connect( |
---|
| 339 | sigc::mem_fun(*this, &SaveDetailsWidget::onNodeMapRowChanged)); |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | // child widgets of vbArcMaps |
---|
| 343 | |
---|
| 344 | { |
---|
| 345 | Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6)); |
---|
| 346 | vbArcMaps->pack_start(*box1, Gtk::PACK_SHRINK); |
---|
| 347 | |
---|
| 348 | Gtk::Label* label1 = |
---|
| 349 | Gtk::manage(new Gtk::Label("<b>Save Destination</b>")); |
---|
| 350 | label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); |
---|
| 351 | label1->set_use_markup(); |
---|
| 352 | box1->pack_start(*label1, Gtk::PACK_SHRINK); |
---|
| 353 | |
---|
| 354 | Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox); |
---|
| 355 | box1->pack_start(*box2, Gtk::PACK_SHRINK); |
---|
| 356 | |
---|
| 357 | Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" ")); |
---|
| 358 | box2->pack_start(*fill1, Gtk::PACK_SHRINK); |
---|
| 359 | |
---|
| 360 | Gtk::Frame* frame = Gtk::manage(new Gtk::Frame); |
---|
| 361 | box2->pack_start(*frame, Gtk::PACK_EXPAND_WIDGET); |
---|
| 362 | |
---|
| 363 | Gtk::ScrolledWindow* swArcMaps = Gtk::manage(new Gtk::ScrolledWindow); |
---|
| 364 | frame->add(*swArcMaps); |
---|
| 365 | |
---|
| 366 | swArcMaps->add(twArcMaps); |
---|
| 367 | |
---|
| 368 | refArcMapStore = Gtk::ListStore::create(ArcMapColumns); |
---|
| 369 | |
---|
| 370 | std::vector<std::string> arc_maps = pMapStorage->getArcMapList(); |
---|
| 371 | for (std::vector<std::string>::const_iterator it = arc_maps.begin(); |
---|
| 372 | it != arc_maps.end(); ++it) |
---|
| 373 | { |
---|
| 374 | Gtk::TreeModel::Row row = *(refArcMapStore->append()); |
---|
| 375 | row[ArcMapColumns.colName] = *it; |
---|
| 376 | switch (pMapStorage->getArcMapSaveDest(*it)) |
---|
| 377 | { |
---|
| 378 | case MapStorage::GUI_SECT: |
---|
| 379 | row[ArcMapColumns.colSaveToMainSect] = false; |
---|
| 380 | row[ArcMapColumns.colSaveToGuiSect] = true; |
---|
| 381 | break; |
---|
| 382 | case MapStorage::NESET_SECT: |
---|
| 383 | row[ArcMapColumns.colSaveToMainSect] = true; |
---|
| 384 | row[ArcMapColumns.colSaveToGuiSect] = false; |
---|
| 385 | break; |
---|
| 386 | case MapStorage::DONT_SAVE: |
---|
| 387 | row[ArcMapColumns.colSaveToMainSect] = false; |
---|
| 388 | row[ArcMapColumns.colSaveToGuiSect] = false; |
---|
| 389 | break; |
---|
| 390 | } |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | twArcMaps.set_model(refArcMapStore); |
---|
| 394 | twArcMaps.append_column("Name", ArcMapColumns.colName); |
---|
| 395 | twArcMaps.append_column_editable("Arcset section", |
---|
| 396 | ArcMapColumns.colSaveToMainSect); |
---|
| 397 | twArcMaps.append_column_editable("GUI section", |
---|
| 398 | ArcMapColumns.colSaveToGuiSect); |
---|
| 399 | |
---|
| 400 | swArcMaps->set_size_request(-1, 200); |
---|
| 401 | swArcMaps->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
---|
| 402 | |
---|
| 403 | refArcMapStore->signal_row_changed().connect( |
---|
| 404 | sigc::mem_fun(*this, &SaveDetailsWidget::onArcMapRowChanged)); |
---|
| 405 | } |
---|
| 406 | |
---|
| 407 | show_all_children(); |
---|
| 408 | } |
---|
| 409 | |
---|
| 410 | void SaveDetailsWidget::onGuiSectSaveDestChanged() |
---|
| 411 | { |
---|
| 412 | if (rbLgfFile.get_active()) |
---|
| 413 | { |
---|
| 414 | pMapStorage->setGUIDataSaveLocation(MapStorage::LGF_FILE); |
---|
| 415 | } |
---|
| 416 | else if (rbConfFile.get_active()) |
---|
| 417 | { |
---|
| 418 | pMapStorage->setGUIDataSaveLocation(MapStorage::CONF_FILE); |
---|
| 419 | } |
---|
| 420 | } |
---|
| 421 | |
---|
| 422 | void SaveDetailsWidget::onArcMapRowChanged(const Gtk::TreeModel::Path& path, |
---|
| 423 | const Gtk::TreeModel::iterator& iter) |
---|
| 424 | { |
---|
| 425 | Gtk::TreeModel::Row row = *iter; |
---|
| 426 | Glib::ustring map_name = row[ArcMapColumns.colName]; |
---|
| 427 | if (row[ArcMapColumns.colSaveToMainSect] && |
---|
| 428 | row[ArcMapColumns.colSaveToGuiSect]) |
---|
| 429 | { |
---|
| 430 | if (pMapStorage->getArcMapSaveDest(map_name) == MapStorage::NESET_SECT) |
---|
| 431 | { |
---|
| 432 | pMapStorage->setArcMapSaveDest(map_name, MapStorage::GUI_SECT); |
---|
| 433 | row[ArcMapColumns.colSaveToMainSect] = false; |
---|
| 434 | } |
---|
| 435 | else |
---|
| 436 | { |
---|
| 437 | pMapStorage->setArcMapSaveDest(map_name, MapStorage::NESET_SECT); |
---|
| 438 | row[ArcMapColumns.colSaveToGuiSect] = false; |
---|
| 439 | } |
---|
| 440 | } |
---|
| 441 | else if (row[ArcMapColumns.colSaveToMainSect]) |
---|
| 442 | { |
---|
| 443 | pMapStorage->setArcMapSaveDest(map_name, MapStorage::NESET_SECT); |
---|
| 444 | } |
---|
| 445 | else if (row[ArcMapColumns.colSaveToGuiSect]) |
---|
| 446 | { |
---|
| 447 | pMapStorage->setArcMapSaveDest(map_name, MapStorage::GUI_SECT); |
---|
| 448 | } |
---|
| 449 | else |
---|
| 450 | { |
---|
| 451 | pMapStorage->setArcMapSaveDest(map_name, MapStorage::DONT_SAVE); |
---|
| 452 | } |
---|
| 453 | } |
---|
| 454 | |
---|
| 455 | void SaveDetailsWidget::onNodeMapRowChanged(const Gtk::TreeModel::Path& path, |
---|
| 456 | const Gtk::TreeModel::iterator& iter) |
---|
| 457 | { |
---|
| 458 | Gtk::TreeModel::Row row = *iter; |
---|
| 459 | Glib::ustring map_name = row[NodeMapColumns.colName]; |
---|
| 460 | if (row[NodeMapColumns.colSaveToMainSect] && |
---|
| 461 | row[NodeMapColumns.colSaveToGuiSect]) |
---|
| 462 | { |
---|
| 463 | if (pMapStorage->getNodeMapSaveDest(map_name) == MapStorage::NESET_SECT) |
---|
| 464 | { |
---|
| 465 | pMapStorage->setNodeMapSaveDest(map_name, MapStorage::GUI_SECT); |
---|
| 466 | row[NodeMapColumns.colSaveToMainSect] = false; |
---|
| 467 | } |
---|
| 468 | else |
---|
| 469 | { |
---|
| 470 | pMapStorage->setNodeMapSaveDest(map_name, MapStorage::NESET_SECT); |
---|
| 471 | row[NodeMapColumns.colSaveToGuiSect] = false; |
---|
| 472 | } |
---|
| 473 | } |
---|
| 474 | else if (row[NodeMapColumns.colSaveToMainSect]) |
---|
| 475 | { |
---|
| 476 | pMapStorage->setNodeMapSaveDest(map_name, MapStorage::NESET_SECT); |
---|
| 477 | } |
---|
| 478 | else if (row[NodeMapColumns.colSaveToGuiSect]) |
---|
| 479 | { |
---|
| 480 | pMapStorage->setNodeMapSaveDest(map_name, MapStorage::GUI_SECT); |
---|
| 481 | } |
---|
| 482 | else |
---|
| 483 | { |
---|
| 484 | pMapStorage->setNodeMapSaveDest(map_name, MapStorage::DONT_SAVE); |
---|
| 485 | } |
---|
| 486 | } |
---|
| 487 | |
---|
| 488 | void SaveDetailsWidget::onNodeCoordSaveDestChanged() |
---|
| 489 | { |
---|
| 490 | if (rblueCoordGuiSection.get_active()) |
---|
| 491 | { |
---|
| 492 | pMapStorage->setNodeCoordsSaveDest(MapStorage::SpecMapSaveOpts::GUI_SECT); |
---|
| 493 | rblueCoordOneMap.set_sensitive(false); |
---|
| 494 | rblueCoordTwoMaps.set_sensitive(false); |
---|
| 495 | entNodeCoordsOneMap.set_sensitive(false); |
---|
| 496 | entNodeCoordsTwoMaps1.set_sensitive(false); |
---|
| 497 | entNodeCoordsTwoMaps2.set_sensitive(false); |
---|
| 498 | } |
---|
| 499 | else if (rblueCoordNodesetSection.get_active()) |
---|
| 500 | { |
---|
| 501 | pMapStorage->setNodeCoordsSaveDest(MapStorage::SpecMapSaveOpts::NESET_SECT); |
---|
| 502 | rblueCoordOneMap.set_sensitive(true); |
---|
| 503 | rblueCoordTwoMaps.set_sensitive(true); |
---|
| 504 | switch (pMapStorage->getNodeCoordsSaveMapNum()) |
---|
| 505 | { |
---|
| 506 | case MapStorage::SpecMapSaveOpts::ONE_MAP: |
---|
| 507 | entNodeCoordsOneMap.set_sensitive(true); |
---|
| 508 | entNodeCoordsTwoMaps1.set_sensitive(false); |
---|
| 509 | entNodeCoordsTwoMaps2.set_sensitive(false); |
---|
| 510 | break; |
---|
| 511 | case MapStorage::SpecMapSaveOpts::TWO_MAPS: |
---|
| 512 | entNodeCoordsOneMap.set_sensitive(false); |
---|
| 513 | entNodeCoordsTwoMaps1.set_sensitive(true); |
---|
| 514 | entNodeCoordsTwoMaps2.set_sensitive(true); |
---|
| 515 | break; |
---|
| 516 | } |
---|
| 517 | } |
---|
| 518 | } |
---|
| 519 | |
---|
| 520 | void SaveDetailsWidget::onNodeCoordMapNumChanged() |
---|
| 521 | { |
---|
| 522 | if (rblueCoordOneMap.get_active()) |
---|
| 523 | { |
---|
| 524 | pMapStorage->setNodeCoordsSaveMapNum(MapStorage::SpecMapSaveOpts::ONE_MAP); |
---|
| 525 | entNodeCoordsOneMap.set_sensitive(true); |
---|
| 526 | entNodeCoordsTwoMaps1.set_sensitive(false); |
---|
| 527 | entNodeCoordsTwoMaps2.set_sensitive(false); |
---|
| 528 | } |
---|
| 529 | else if (rblueCoordTwoMaps.get_active()) |
---|
| 530 | { |
---|
| 531 | pMapStorage->setNodeCoordsSaveMapNum(MapStorage::SpecMapSaveOpts::TWO_MAPS); |
---|
| 532 | entNodeCoordsOneMap.set_sensitive(false); |
---|
| 533 | entNodeCoordsTwoMaps1.set_sensitive(true); |
---|
| 534 | entNodeCoordsTwoMaps2.set_sensitive(true); |
---|
| 535 | } |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | void SaveDetailsWidget::onNodeCoordsOneMapName() |
---|
| 539 | { |
---|
| 540 | pMapStorage->setNodeCoordsOneMapName(entNodeCoordsOneMap.get_text()); |
---|
| 541 | } |
---|
| 542 | void SaveDetailsWidget::onNodeCoordsTwoMaps1Name() |
---|
| 543 | { |
---|
| 544 | pMapStorage->setNodeCoordsTwoMaps1Name(entNodeCoordsTwoMaps1.get_text()); |
---|
| 545 | } |
---|
| 546 | void SaveDetailsWidget::onNodeCoordsTwoMaps2Name() |
---|
| 547 | { |
---|
| 548 | pMapStorage->setNodeCoordsTwoMaps2Name(entNodeCoordsTwoMaps2.get_text()); |
---|
| 549 | } |
---|
| 550 | |
---|
| 551 | void SaveDetailsWidget::onArrowCoordSaveDestChanged() |
---|
| 552 | { |
---|
| 553 | if (rbArrowCoordGuiSection.get_active()) |
---|
| 554 | { |
---|
| 555 | pMapStorage->setArrowCoordsSaveDest(MapStorage::SpecMapSaveOpts::GUI_SECT); |
---|
| 556 | rbArrowCoordOneMap.set_sensitive(false); |
---|
| 557 | rbArrowCoordTwoMaps.set_sensitive(false); |
---|
| 558 | entArrowCoordsOneMap.set_sensitive(false); |
---|
| 559 | entArrowCoordsTwoMaps1.set_sensitive(false); |
---|
| 560 | entArrowCoordsTwoMaps2.set_sensitive(false); |
---|
| 561 | } |
---|
| 562 | else if (rbArrowCoordArcsetSection.get_active()) |
---|
| 563 | { |
---|
| 564 | pMapStorage->setArrowCoordsSaveDest(MapStorage::SpecMapSaveOpts::NESET_SECT); |
---|
| 565 | rbArrowCoordOneMap.set_sensitive(true); |
---|
| 566 | rbArrowCoordTwoMaps.set_sensitive(true); |
---|
| 567 | switch (pMapStorage->getArrowCoordsSaveMapNum()) |
---|
| 568 | { |
---|
| 569 | case MapStorage::SpecMapSaveOpts::ONE_MAP: |
---|
| 570 | entArrowCoordsOneMap.set_sensitive(true); |
---|
| 571 | entArrowCoordsTwoMaps1.set_sensitive(false); |
---|
| 572 | entArrowCoordsTwoMaps2.set_sensitive(false); |
---|
| 573 | break; |
---|
| 574 | case MapStorage::SpecMapSaveOpts::TWO_MAPS: |
---|
| 575 | entArrowCoordsOneMap.set_sensitive(false); |
---|
| 576 | entArrowCoordsTwoMaps1.set_sensitive(true); |
---|
| 577 | entArrowCoordsTwoMaps2.set_sensitive(true); |
---|
| 578 | break; |
---|
| 579 | } |
---|
| 580 | } |
---|
| 581 | } |
---|
| 582 | |
---|
| 583 | void SaveDetailsWidget::onArrowCoordMapNumChanged() |
---|
| 584 | { |
---|
| 585 | if (rbArrowCoordOneMap.get_active()) |
---|
| 586 | { |
---|
| 587 | pMapStorage->setArrowCoordsSaveMapNum(MapStorage::SpecMapSaveOpts::ONE_MAP); |
---|
| 588 | entArrowCoordsOneMap.set_sensitive(true); |
---|
| 589 | entArrowCoordsTwoMaps1.set_sensitive(false); |
---|
| 590 | entArrowCoordsTwoMaps2.set_sensitive(false); |
---|
| 591 | } |
---|
| 592 | else if (rbArrowCoordTwoMaps.get_active()) |
---|
| 593 | { |
---|
| 594 | pMapStorage->setArrowCoordsSaveMapNum(MapStorage::SpecMapSaveOpts::TWO_MAPS); |
---|
| 595 | entArrowCoordsOneMap.set_sensitive(false); |
---|
| 596 | entArrowCoordsTwoMaps1.set_sensitive(true); |
---|
| 597 | entArrowCoordsTwoMaps2.set_sensitive(true); |
---|
| 598 | } |
---|
| 599 | } |
---|
| 600 | |
---|
| 601 | void SaveDetailsWidget::onArrowCoordsOneMapName() |
---|
| 602 | { |
---|
| 603 | pMapStorage->setArrowCoordsOneMapName(entArrowCoordsOneMap.get_text()); |
---|
| 604 | } |
---|
| 605 | void SaveDetailsWidget::onArrowCoordsTwoMaps1Name() |
---|
| 606 | { |
---|
| 607 | pMapStorage->setArrowCoordsTwoMaps1Name(entArrowCoordsTwoMaps1.get_text()); |
---|
| 608 | } |
---|
| 609 | void SaveDetailsWidget::onArrowCoordsTwoMaps2Name() |
---|
| 610 | { |
---|
| 611 | pMapStorage->setArrowCoordsTwoMaps2Name(entArrowCoordsTwoMaps2.get_text()); |
---|
| 612 | } |
---|
| 613 | |
---|
| 614 | SaveDetailsWidget::~SaveDetailsWidget() |
---|
| 615 | { |
---|
| 616 | } |
---|