diff options
author | Manoj Rajagopalan <manoj@nanorex.com> | 2008-02-25 20:30:15 +0000 |
---|---|---|
committer | Manoj Rajagopalan <manoj@nanorex.com> | 2008-02-25 20:30:15 +0000 |
commit | e56c380fdaec49ef11e042661ed16834b61affe8 (patch) | |
tree | cea4ff1c1f851b61ba2da692f03a503c3244fab8 | |
parent | 8d6db889c21c22114224786fbf3be2ddebce7d1d (diff) | |
download | nanoengineer-theirix-e56c380fdaec49ef11e042661ed16834b61affe8.tar.gz nanoengineer-theirix-e56c380fdaec49ef11e042661ed16834b61affe8.zip |
Implemented File->Close
-rw-r--r-- | cad/plugins/NanoVision-1/src/Documentation/NV1_Design.odt | bin | 519592 -> 519246 bytes | |||
-rw-r--r-- | cad/plugins/NanoVision-1/src/Icons/File/Close.png | bin | 0 -> 2085 bytes | |||
-rw-r--r-- | cad/plugins/NanoVision-1/src/Interface/NXDataStoreInfo.cpp | 27 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.cpp | 192 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.rl | 4 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/ResultsWindow.cpp | 16 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/ResultsWindow.h | 2 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/application.qrc | 3 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/nv1.cpp | 100 | ||||
-rw-r--r-- | cad/plugins/NanoVision-1/src/nv1.h | 20 |
10 files changed, 209 insertions, 155 deletions
diff --git a/cad/plugins/NanoVision-1/src/Documentation/NV1_Design.odt b/cad/plugins/NanoVision-1/src/Documentation/NV1_Design.odt Binary files differindex 44e493ad4..af58b0602 100644 --- a/cad/plugins/NanoVision-1/src/Documentation/NV1_Design.odt +++ b/cad/plugins/NanoVision-1/src/Documentation/NV1_Design.odt diff --git a/cad/plugins/NanoVision-1/src/Icons/File/Close.png b/cad/plugins/NanoVision-1/src/Icons/File/Close.png Binary files differnew file mode 100644 index 000000000..b049b6886 --- /dev/null +++ b/cad/plugins/NanoVision-1/src/Icons/File/Close.png diff --git a/cad/plugins/NanoVision-1/src/Interface/NXDataStoreInfo.cpp b/cad/plugins/NanoVision-1/src/Interface/NXDataStoreInfo.cpp index 524e6e9a4..cad7f88e2 100644 --- a/cad/plugins/NanoVision-1/src/Interface/NXDataStoreInfo.cpp +++ b/cad/plugins/NanoVision-1/src/Interface/NXDataStoreInfo.cpp @@ -7,10 +7,29 @@ namespace Nanorex { /* CONSTRUCTOR */ -NXDataStoreInfo::NXDataStoreInfo() { - _isSimulationResults = false; - _isSingleStructure = false; - _inputParameters = _resultsSummary = 0; +NXDataStoreInfo::NXDataStoreInfo() + : _isSimulationResults(false), + _isSingleStructure(false), + _inputParameters(NULL), + _resultsSummary(NULL) +{ +} + + +/* FUNCTION: reset */ +void NXDataStoreInfo::reset(void) +{ + _fileNames.clear(); + _inputStructures.clear(); + _trajectories.clear(); + _handle.clear(); + _isLastFrame.clear(); + _storeIsComplete.clear(); + _isSimulationResults = false; + _isSingleStructure = false; + if(_inputParameters != NULL) delete _inputParameters; + if(_resultsSummary != NULL) delete _resultsSummary; + _inputParameters = _resultsSummary = NULL; } diff --git a/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.cpp b/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.cpp index e5a76d7e1..148402454 100644 --- a/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.cpp +++ b/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.cpp @@ -68,13 +68,13 @@ static const short _mmp_parser_key_offsets[] = { 211, 215, 216, 217, 221, 222, 223, 227, 228, 229, 233, 235, 241, 243, 249, 251, 257, 263, 266, 271, 277, 283, 286, 289, - 292, 295, 298, 301, 305, 315, 326, 337, - 340, 349, 350, 351, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 368, - 378, 389, 400, 410, 421, 433, 444, 457, - 470, 483, 486, 490, 500, 511, 522, 526, - 527, 538, 549, 560, 571, 582, 593, 604, - 608, 619, 623, 629, 633, 645, 658, 662 + 292, 295, 298, 301, 305, 315, 327, 339, + 342, 351, 352, 353, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 370, + 380, 392, 404, 414, 426, 438, 450, 463, + 476, 489, 492, 496, 506, 518, 530, 534, + 535, 546, 557, 568, 579, 590, 601, 612, + 616, 627, 631, 637, 641, 653, 666, 670 }; static const char _mmp_parser_trans_keys[] = { @@ -117,32 +117,33 @@ static const char _mmp_parser_trans_keys[] = { 13, 32, 9, 13, 32, 9, 13, 32, 9, 13, 32, 9, 13, 32, 40, 9, 13, 32, 95, 9, 13, 48, 57, 65, - 90, 97, 122, 32, 41, 95, 9, 13, - 48, 57, 65, 90, 97, 122, 32, 41, - 95, 9, 13, 48, 57, 65, 90, 97, - 122, 32, 9, 13, 32, 99, 100, 105, - 108, 116, 118, 9, 13, 112, 107, 10, - 32, 9, 13, 101, 102, 110, 118, 105, - 110, 117, 98, 100, 119, 32, 9, 13, - 32, 95, 9, 13, 48, 57, 65, 90, - 97, 122, 32, 61, 95, 9, 13, 48, - 57, 65, 90, 97, 122, 32, 61, 95, + 90, 97, 122, 32, 41, 45, 95, 9, + 13, 48, 57, 65, 90, 97, 122, 32, + 41, 45, 95, 9, 13, 48, 57, 65, + 90, 97, 122, 32, 9, 13, 32, 99, + 100, 105, 108, 116, 118, 9, 13, 112, + 107, 10, 32, 9, 13, 101, 102, 110, + 118, 105, 110, 117, 98, 100, 119, 32, + 9, 13, 32, 95, 9, 13, 48, 57, + 65, 90, 97, 122, 32, 45, 61, 95, 9, 13, 48, 57, 65, 90, 97, 122, - 32, 95, 9, 13, 48, 57, 65, 90, - 97, 122, 10, 32, 45, 9, 13, 48, - 57, 65, 90, 97, 122, 10, 32, 45, - 95, 9, 13, 48, 57, 65, 90, 97, - 122, 10, 32, 45, 9, 13, 48, 57, + 32, 45, 61, 95, 9, 13, 48, 57, + 65, 90, 97, 122, 32, 95, 9, 13, + 48, 57, 65, 90, 97, 122, 10, 32, + 45, 95, 9, 13, 48, 57, 65, 90, + 97, 122, 10, 32, 45, 95, 9, 13, + 48, 57, 65, 90, 97, 122, 10, 32, + 45, 95, 9, 13, 48, 57, 65, 90, + 97, 122, 10, 32, 45, 61, 95, 9, + 13, 48, 57, 65, 90, 97, 122, 10, + 32, 45, 61, 95, 9, 13, 48, 57, 65, 90, 97, 122, 10, 32, 45, 61, 95, 9, 13, 48, 57, 65, 90, 97, - 122, 10, 32, 45, 61, 95, 9, 13, - 48, 57, 65, 90, 97, 122, 10, 32, - 45, 61, 95, 9, 13, 48, 57, 65, - 90, 97, 122, 32, 9, 13, 32, 40, - 9, 13, 32, 95, 9, 13, 48, 57, - 65, 90, 97, 122, 32, 41, 95, 9, - 13, 48, 57, 65, 90, 97, 122, 32, - 41, 95, 9, 13, 48, 57, 65, 90, + 122, 32, 9, 13, 32, 40, 9, 13, + 32, 95, 9, 13, 48, 57, 65, 90, + 97, 122, 32, 41, 45, 95, 9, 13, + 48, 57, 65, 90, 97, 122, 32, 41, + 45, 95, 9, 13, 48, 57, 65, 90, 97, 122, 10, 32, 9, 13, 10, 10, 32, 35, 97, 98, 101, 103, 105, 109, 9, 13, 10, 32, 35, 97, 98, 101, @@ -176,11 +177,11 @@ static const char _mmp_parser_single_lengths[] = { 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 0, 2, 0, 2, 0, 2, 6, 1, 1, 2, 2, 1, 1, 1, - 1, 1, 1, 2, 2, 3, 3, 1, + 1, 1, 1, 2, 2, 4, 4, 1, 7, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 3, 3, 2, 3, 4, 3, 5, 5, - 5, 1, 2, 2, 3, 3, 2, 1, + 4, 4, 2, 4, 4, 4, 5, 5, + 5, 1, 2, 2, 4, 4, 2, 1, 9, 9, 9, 9, 9, 9, 9, 2, 9, 2, 2, 2, 4, 5, 2, 0 }; @@ -220,13 +221,13 @@ static const short _mmp_parser_index_offsets[] = { 241, 245, 247, 249, 253, 255, 257, 261, 263, 265, 269, 271, 276, 278, 283, 285, 290, 297, 300, 304, 309, 314, 317, 320, - 323, 326, 329, 332, 336, 343, 351, 359, - 362, 371, 373, 375, 379, 381, 383, 385, - 387, 389, 391, 393, 395, 397, 399, 402, - 409, 417, 425, 432, 440, 449, 457, 467, - 477, 487, 490, 494, 501, 509, 517, 521, - 523, 534, 545, 556, 567, 578, 589, 600, - 604, 615, 619, 624, 628, 637, 647, 651 + 323, 326, 329, 332, 336, 343, 352, 361, + 364, 373, 375, 377, 381, 383, 385, 387, + 389, 391, 393, 395, 397, 399, 401, 404, + 411, 420, 429, 436, 445, 454, 463, 473, + 483, 493, 496, 500, 507, 516, 525, 529, + 531, 542, 553, 564, 575, 586, 597, 608, + 612, 623, 627, 632, 636, 645, 655, 659 }; static const unsigned char _mmp_parser_indicies[] = { @@ -273,45 +274,46 @@ static const unsigned char _mmp_parser_indicies[] = { 133, 133, 45, 134, 134, 45, 135, 135, 45, 136, 136, 45, 136, 137, 136, 45, 137, 138, 137, 138, 138, 138, 45, 139, - 140, 139, 139, 139, 139, 139, 45, 139, - 140, 139, 139, 139, 139, 139, 45, 141, - 141, 45, 141, 142, 143, 144, 145, 146, - 147, 141, 45, 148, 45, 149, 45, 150, - 149, 149, 45, 151, 45, 149, 45, 152, - 45, 149, 45, 153, 45, 149, 45, 154, - 45, 149, 45, 155, 45, 149, 45, 156, - 156, 45, 156, 157, 156, 157, 157, 157, - 45, 158, 159, 158, 158, 158, 158, 158, - 45, 158, 159, 158, 158, 158, 158, 158, - 45, 159, 160, 159, 160, 160, 160, 45, - 162, 161, 163, 161, 163, 163, 163, 45, - 162, 161, 163, 157, 161, 164, 164, 164, - 45, 162, 161, 163, 161, 163, 163, 163, - 45, 166, 165, 163, 159, 158, 165, 167, - 167, 167, 45, 166, 165, 163, 159, 169, - 165, 168, 168, 168, 45, 166, 165, 163, - 159, 158, 165, 167, 167, 167, 45, 170, - 170, 45, 170, 171, 170, 45, 171, 172, - 171, 172, 172, 172, 45, 173, 174, 173, - 173, 173, 173, 173, 45, 173, 174, 173, - 173, 173, 173, 173, 45, 175, 174, 174, - 45, 177, 176, 179, 178, 2, 180, 181, - 182, 183, 184, 185, 178, 0, 188, 187, - 189, 190, 191, 192, 193, 194, 195, 187, - 186, 1, 178, 2, 180, 181, 182, 183, - 184, 185, 178, 0, 198, 197, 199, 200, - 201, 202, 203, 204, 205, 197, 196, 1, - 206, 2, 180, 181, 182, 183, 207, 185, - 206, 0, 209, 208, 189, 210, 191, 192, - 193, 194, 195, 208, 186, 23, 211, 2, - 212, 181, 182, 183, 184, 185, 211, 0, - 34, 35, 34, 33, 213, 211, 2, 212, - 181, 182, 183, 184, 185, 211, 0, 88, + 140, 139, 139, 139, 139, 139, 139, 45, + 139, 140, 139, 139, 139, 139, 139, 139, + 45, 141, 141, 45, 141, 142, 143, 144, + 145, 146, 147, 141, 45, 148, 45, 149, + 45, 150, 149, 149, 45, 151, 45, 149, + 45, 152, 45, 149, 45, 153, 45, 149, + 45, 154, 45, 149, 45, 155, 45, 149, + 45, 156, 156, 45, 156, 157, 156, 157, + 157, 157, 45, 158, 158, 159, 158, 158, + 158, 158, 158, 45, 158, 158, 159, 158, + 158, 158, 158, 158, 45, 159, 160, 159, + 160, 160, 160, 45, 162, 161, 163, 163, + 161, 163, 163, 163, 45, 162, 161, 163, + 164, 161, 164, 164, 164, 45, 162, 161, + 163, 163, 161, 163, 163, 163, 45, 166, + 165, 167, 159, 167, 165, 167, 167, 167, + 45, 166, 165, 167, 159, 168, 165, 168, + 168, 168, 45, 166, 165, 167, 159, 167, + 165, 167, 167, 167, 45, 169, 169, 45, + 169, 170, 169, 45, 170, 171, 170, 171, + 171, 171, 45, 172, 173, 172, 172, 172, + 172, 172, 172, 45, 172, 173, 172, 172, + 172, 172, 172, 172, 45, 174, 173, 173, + 45, 176, 175, 178, 177, 2, 179, 180, + 181, 182, 183, 184, 177, 0, 187, 186, + 188, 189, 190, 191, 192, 193, 194, 186, + 185, 1, 177, 2, 179, 180, 181, 182, + 183, 184, 177, 0, 197, 196, 198, 199, + 200, 201, 202, 203, 204, 196, 195, 1, + 205, 2, 179, 180, 181, 182, 206, 184, + 205, 0, 208, 207, 188, 209, 190, 191, + 192, 193, 194, 207, 185, 23, 210, 2, + 211, 180, 181, 182, 183, 184, 210, 0, + 34, 35, 34, 33, 212, 210, 2, 211, + 180, 181, 182, 183, 184, 210, 0, 88, 87, 87, 45, 130, 129, 129, 126, 45, - 150, 149, 149, 45, 162, 161, 163, 157, - 161, 164, 164, 164, 45, 166, 165, 163, - 159, 169, 165, 168, 168, 168, 45, 175, - 174, 174, 45, 45, 0 + 150, 149, 149, 45, 162, 161, 163, 164, + 161, 164, 164, 164, 45, 166, 165, 167, + 159, 168, 165, 168, 168, 168, 45, 174, + 173, 173, 45, 45, 0 }; static const unsigned char _mmp_parser_trans_targs_wi[] = { @@ -336,12 +338,12 @@ static const unsigned char _mmp_parser_trans_targs_wi[] = { 110, 112, 114, 116, 106, 107, 147, 109, 111, 113, 115, 117, 119, 120, 121, 122, 123, 124, 148, 125, 126, 127, 149, 128, - 126, 120, 130, 131, 132, 133, 134, 150, - 135, 151, 138, 136, 3, 6, 9, 14, - 26, 38, 1, 138, 136, 2, 3, 6, - 9, 14, 26, 38, 1, 138, 136, 2, - 3, 6, 9, 14, 26, 38, 140, 18, - 142, 144, 23, 142, 23, 144 + 126, 130, 131, 132, 133, 134, 150, 135, + 151, 138, 136, 3, 6, 9, 14, 26, + 38, 1, 138, 136, 2, 3, 6, 9, + 14, 26, 38, 1, 138, 136, 2, 3, + 6, 9, 14, 26, 38, 140, 18, 142, + 144, 23, 142, 23, 144 }; static const unsigned char _mmp_parser_trans_actions_wi[] = { @@ -366,12 +368,12 @@ static const unsigned char _mmp_parser_trans_actions_wi[] = { 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 78, 127, 11, 11, 123, 131, 75, - 75, 7, 0, 0, 0, 7, 0, 41, - 0, 43, 0, 0, 0, 0, 0, 0, - 0, 0, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 0, 0, - 59, 59, 59, 0, 0, 0 + 75, 0, 0, 0, 7, 0, 41, 0, + 43, 0, 0, 0, 0, 0, 0, 0, + 0, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 0, 0, 59, + 59, 59, 0, 0, 0 }; static const unsigned char _mmp_parser_to_state_actions[] = { @@ -476,7 +478,7 @@ void NanorexMMPImportExport::reset(void) // initialize the ragel engine -#line 480 "NanorexMMPImportExport.cpp" +#line 482 "NanorexMMPImportExport.cpp" { cs = mmp_parser_start; top = 0; @@ -536,7 +538,7 @@ bool NanorexMMPImportExport::readMMP(istream& instream, // Ragel parser implementation bool success = true; -#line 540 "NanorexMMPImportExport.cpp" +#line 542 "NanorexMMPImportExport.cpp" { int _klen; unsigned int _trans; @@ -878,7 +880,7 @@ _match: #line 268 "NanorexMMPImportExport.rl" {success = false;} break; -#line 882 "NanorexMMPImportExport.cpp" +#line 884 "NanorexMMPImportExport.cpp" } } @@ -899,7 +901,7 @@ _again: #line 56 "NanorexMMPImportExport.rl" {stringval2.clear(); stringval2 = stringval2 + (*p);} break; -#line 903 "NanorexMMPImportExport.cpp" +#line 905 "NanorexMMPImportExport.cpp" } } @@ -926,7 +928,7 @@ _again: #line 268 "NanorexMMPImportExport.rl" {success = false;} break; -#line 930 "NanorexMMPImportExport.cpp" +#line 932 "NanorexMMPImportExport.cpp" } } } diff --git a/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.rl b/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.rl index 7d3fabd37..146f4be76 100644 --- a/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.rl +++ b/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/NanorexMMPImportExport.rl @@ -47,12 +47,12 @@ inline void DEBUG_MSG(string const& filename, int line, string const& s) ${stringval = stringval + fc; } ; - charStringWithSpace = ('_' | alnum) (space | '_' | alnum)* + charStringWithSpace = ('_' | alnum) (space | [_\-] | alnum)* >to{stringval.clear(); stringval = stringval + fc;} ${stringval = stringval + fc; } ; - charStringWithSpace2 = ('_' | alnum) (space | '-' | alnum)* + charStringWithSpace2 = ('_' | alnum) (space | [_\-] | alnum)* >to{stringval2.clear(); stringval2 = stringval2 + fc;} ${stringval2 = stringval2 + fc; } ; diff --git a/cad/plugins/NanoVision-1/src/ResultsWindow.cpp b/cad/plugins/NanoVision-1/src/ResultsWindow.cpp index f8870cb4f..7dec5c0b0 100644 --- a/cad/plugins/NanoVision-1/src/ResultsWindow.cpp +++ b/cad/plugins/NanoVision-1/src/ResultsWindow.cpp @@ -49,6 +49,18 @@ ResultsWindow::~ResultsWindow() { } +/* FUNCTION: closeFile */ +bool ResultsWindow::closeFile(void) +{ + QWidget *tab1Widget = tabWidget->widget(0); + resultsTree = dynamic_cast<QTreeWidget*>(tab1Widget); + resultsTree->clear(); + resultsTree->setHeaderLabel(tr("")); + entityManager->reset(); + return true; +} + + /* FUNCTION: loadFile */ bool ResultsWindow::loadFile(const QString &fileName) { @@ -77,7 +89,7 @@ bool ResultsWindow::loadFile(const QString &fileName) { // populate results tree updateResultsTree(); - // Discover a store-not-complete trajectory frame set +/* // Discover a store-not-complete trajectory frame set int trajId = dataStoreInfo->getTrajectoryId("frame-set-1"); TrajectoryGraphicsPane* trajPane = new TrajectoryGraphicsPane(); trajPane->setEntityManager(entityManager); @@ -88,7 +100,7 @@ bool ResultsWindow::loadFile(const QString &fileName) { SIGNAL(newFrameAdded(int, int, NXMoleculeSet*)), trajPane, SLOT(newFrame(int, int, NXMoleculeSet*))); - } + }*/ /* MDI data window example DataWindow *child = new DataWindow; diff --git a/cad/plugins/NanoVision-1/src/ResultsWindow.h b/cad/plugins/NanoVision-1/src/ResultsWindow.h index 4b8469482..ac42a3d60 100644 --- a/cad/plugins/NanoVision-1/src/ResultsWindow.h +++ b/cad/plugins/NanoVision-1/src/ResultsWindow.h @@ -37,6 +37,8 @@ public: ~ResultsWindow(); bool loadFile(const QString &fileName); + bool closeFile(void); + QString userFriendlyCurrentFile(); QString currentFile() { return curFile; diff --git a/cad/plugins/NanoVision-1/src/application.qrc b/cad/plugins/NanoVision-1/src/application.qrc index fa7432526..9c644e7e7 100644 --- a/cad/plugins/NanoVision-1/src/application.qrc +++ b/cad/plugins/NanoVision-1/src/application.qrc @@ -1,6 +1,7 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>Icons/File/Open.png</file> + <file>Icons/File/Close.png</file> <file>Icons/splashscreen.png</file> <file>Icons/eye-icon.png</file> <file>Icons/home.png</file> @@ -12,6 +13,8 @@ <file>Icons/results.png</file> <file>Icons/results_summary.png</file> <file>Icons/trajectories.png</file> + <file>Icons/atom.png</file> + <file>Icons/atom_set.png</file> <file>Icons/error.png</file> </qresource> </RCC> diff --git a/cad/plugins/NanoVision-1/src/nv1.cpp b/cad/plugins/NanoVision-1/src/nv1.cpp index 140aafbb2..c62e3031e 100644 --- a/cad/plugins/NanoVision-1/src/nv1.cpp +++ b/cad/plugins/NanoVision-1/src/nv1.cpp @@ -18,7 +18,7 @@ nv1::nv1(NXEntityManager* entityManager, LogHandlerWidget* logHandlerWidget) mainWindowTabs->vboxLayout->removeWidget(mainWindowTabs->widget); delete mainWindowTabs->widget; mainWindowTabs->vboxLayout->addWidget(resultsWindow); - resultsWindow->hide(); + // resultsWindow->hide(); createActions(); createMenus(); @@ -114,6 +114,12 @@ void nv1::open() { } +/* FUNCTION: close */ +void nv1::close() { + resultsWindow->closeFile(); +} + + /* FUNCTION: about */ void nv1::about() { QMessageBox::about(this, @@ -127,33 +133,33 @@ void nv1::about() { /* FUNCTION: updateMenus */ void nv1::updateMenus() { bool hasResultsWindow = resultsWindow->isVisible(); - closeAction->setEnabled(hasResultsWindow); - closeAllAction->setEnabled(hasResultsWindow); - tileAction->setEnabled(hasResultsWindow); - cascadeAction->setEnabled(hasResultsWindow); - arrangeAction->setEnabled(hasResultsWindow); - nextAction->setEnabled(hasResultsWindow); - previousAction->setEnabled(hasResultsWindow); - separatorAction->setVisible(hasResultsWindow); + windowCloseAction->setEnabled(hasResultsWindow); + windowCloseAllAction->setEnabled(hasResultsWindow); + windowTileAction->setEnabled(hasResultsWindow); + windowCascadeAction->setEnabled(hasResultsWindow); + windowArrangeAction->setEnabled(hasResultsWindow); + windowNextAction->setEnabled(hasResultsWindow); + windowPreviousAction->setEnabled(hasResultsWindow); + windowSeparatorAction->setVisible(hasResultsWindow); } /* FUNCTION: updateWindowMenu */ void nv1::updateWindowMenu() { windowMenu->clear(); - windowMenu->addAction(closeAction); - windowMenu->addAction(closeAllAction); + windowMenu->addAction(windowCloseAction); + windowMenu->addAction(windowCloseAllAction); windowMenu->addSeparator(); - windowMenu->addAction(tileAction); - windowMenu->addAction(cascadeAction); - windowMenu->addAction(arrangeAction); + windowMenu->addAction(windowTileAction); + windowMenu->addAction(windowCascadeAction); + windowMenu->addAction(windowArrangeAction); windowMenu->addSeparator(); - windowMenu->addAction(nextAction); - windowMenu->addAction(previousAction); - windowMenu->addAction(separatorAction); + windowMenu->addAction(windowNextAction); + windowMenu->addAction(windowPreviousAction); + windowMenu->addAction(windowSeparatorAction); QList<QWidget*> windows = resultsWindow->workspace->windowList(); - separatorAction->setVisible(!windows.isEmpty()); + windowSeparatorAction->setVisible(!windows.isEmpty()); for (int index = 0; index < windows.size(); ++index) { DataWindow* window = qobject_cast<DataWindow*>(windows.at(index)); @@ -190,50 +196,56 @@ void nv1::createActions() { openAction->setStatusTip(tr("Open an existing file")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); - exitAction = new QAction(tr("E&xit"), this); + closeAction = + new QAction(QIcon(":/Icons/File/Close.png"), tr("&Close"), this); + closeAction->setShortcut(tr("Ctrl+W")); + closeAction->setStatusTip(tr("Close and open file")); + connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); + + exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("Exit NanoVision-1")); connect(exitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); - closeAction = new QAction(tr("Cl&ose"), this); - closeAction->setShortcut(tr("Ctrl+F4")); - closeAction->setStatusTip(tr("Close the active window")); - connect(closeAction, SIGNAL(triggered()), + windowCloseAction = new QAction(tr("Cl&ose"), this); + windowCloseAction->setShortcut(tr("Ctrl+F4")); + windowCloseAction->setStatusTip(tr("Close the active window")); + connect(windowCloseAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(closeActiveWindow())); - closeAllAction = new QAction(tr("Close &All"), this); - closeAllAction->setStatusTip(tr("Close all the windows")); - connect(closeAllAction, SIGNAL(triggered()), + windowCloseAllAction = new QAction(tr("Close &All"), this); + windowCloseAllAction->setStatusTip(tr("Close all the windows")); + connect(windowCloseAllAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(closeAllWindows())); - tileAction = new QAction(tr("&Tile"), this); - tileAction->setStatusTip(tr("Tile the windows")); - connect(tileAction, SIGNAL(triggered()), resultsWindow->workspace, + windowTileAction = new QAction(tr("&Tile"), this); + windowTileAction->setStatusTip(tr("Tile the windows")); + connect(windowTileAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(tile())); - cascadeAction = new QAction(tr("&Cascade"), this); - cascadeAction->setStatusTip(tr("Cascade the windows")); - connect(cascadeAction, SIGNAL(triggered()), resultsWindow->workspace, + windowCascadeAction = new QAction(tr("&Cascade"), this); + windowCascadeAction->setStatusTip(tr("Cascade the windows")); + connect(windowCascadeAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(cascade())); - arrangeAction = new QAction(tr("Arrange &icons"), this); - arrangeAction->setStatusTip(tr("Arrange the icons")); - connect(arrangeAction, SIGNAL(triggered()), resultsWindow->workspace, + windowArrangeAction = new QAction(tr("Arrange &icons"), this); + windowArrangeAction->setStatusTip(tr("Arrange the icons")); + connect(windowArrangeAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(arrangeIcons())); - nextAction = new QAction(tr("Ne&xt"), this); - nextAction->setStatusTip(tr("Move the focus to the next window")); - connect(nextAction, SIGNAL(triggered()), + windowNextAction = new QAction(tr("Ne&xt"), this); + windowNextAction->setStatusTip(tr("Move the focus to the next window")); + connect(windowNextAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(activateNextWindow())); - previousAction = new QAction(tr("Pre&vious"), this); - previousAction->setStatusTip(tr("Move the focus to the previous " + windowPreviousAction = new QAction(tr("Pre&vious"), this); + windowPreviousAction->setStatusTip(tr("Move the focus to the previous " "window")); - connect(previousAction, SIGNAL(triggered()), + connect(windowPreviousAction, SIGNAL(triggered()), resultsWindow->workspace, SLOT(activatePreviousWindow())); - separatorAction = new QAction(this); - separatorAction->setSeparator(true); + windowSeparatorAction = new QAction(this); + windowSeparatorAction->setSeparator(true); aboutAction = new QAction(tr("&About"), this); aboutAction->setStatusTip(tr("Show NanoVision-1's About box")); @@ -245,6 +257,7 @@ void nv1::createActions() { void nv1::createMenus() { fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(openAction); + fileMenu->addAction(closeAction); fileMenu->addSeparator(); fileMenu->addAction(exitAction); @@ -265,6 +278,7 @@ void nv1::createMenus() { void nv1::createToolBars() { fileToolBar = addToolBar(tr("File")); fileToolBar->addAction(openAction); + fileToolBar->addAction(closeAction); } diff --git a/cad/plugins/NanoVision-1/src/nv1.h b/cad/plugins/NanoVision-1/src/nv1.h index 69dee1df5..96f785a64 100644 --- a/cad/plugins/NanoVision-1/src/nv1.h +++ b/cad/plugins/NanoVision-1/src/nv1.h @@ -43,6 +43,7 @@ public slots: private slots: void open(); + void close(); void about(); void updateWindowMenu(); void abortJob(const QString& id); @@ -62,20 +63,21 @@ private: // File QAction* openAction; - QAction* exitAction; + QAction* closeAction; + QAction* exitAction; // Job Management QAction* abortJobAction; // Window - QAction* closeAction; - QAction* closeAllAction; - QAction* tileAction; - QAction* cascadeAction; - QAction* arrangeAction; - QAction* nextAction; - QAction* previousAction; - QAction* separatorAction; + QAction* windowCloseAction; + QAction* windowCloseAllAction; + QAction* windowTileAction; + QAction* windowCascadeAction; + QAction* windowArrangeAction; + QAction* windowNextAction; + QAction* windowPreviousAction; + QAction* windowSeparatorAction; // Help QAction* aboutAction; |