Select new styles in the styles manager when they are created.

Originally committed to SVN as r4799.
This commit is contained in:
Thomas Goyne 2010-10-11 20:05:52 +00:00
parent ed9968e172
commit dade679145
2 changed files with 33 additions and 87 deletions

View File

@ -58,6 +58,36 @@
#include "subs_grid.h" #include "subs_grid.h"
#include "utils.h" #include "utils.h"
/// IDs
enum {
BUTTON_CATALOG_NEW = 1000,
BUTTON_CATALOG_DELETE,
BUTTON_STORAGE_COPYTO,
BUTTON_STORAGE_NEW,
BUTTON_STORAGE_EDIT,
BUTTON_STORAGE_COPY,
BUTTON_STORAGE_DELETE,
BUTTON_STORAGE_UP,
BUTTON_STORAGE_DOWN,
BUTTON_STORAGE_TOP,
BUTTON_STORAGE_BOTTOM,
BUTTON_STORAGE_SORT,
BUTTON_CURRENT_COPYTO,
BUTTON_CURRENT_NEW,
BUTTON_CURRENT_EDIT,
BUTTON_CURRENT_COPY,
BUTTON_CURRENT_DELETE,
BUTTON_CURRENT_IMPORT,
BUTTON_CURRENT_UP,
BUTTON_CURRENT_DOWN,
BUTTON_CURRENT_TOP,
BUTTON_CURRENT_BOTTOM,
BUTTON_CURRENT_SORT,
LIST_CATALOG,
LIST_STORAGE,
LIST_CURRENT
};
/// @brief Constructor /// @brief Constructor
/// @param parent /// @param parent
/// @param _grid /// @param _grid
@ -205,7 +235,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
wxString selected_style; wxString selected_style;
if (_grid) { if (_grid) {
AssDialogue *dia = _grid->GetDialogue(_grid->GetFirstSelRow()); AssDialogue *dia = _grid->GetDialogue(_grid->GetFirstSelRow());
if(dia) selected_style = dia->Style; if(dia) selected_style = dia->Style;
} }
if (StorageList->GetCount() && StorageList->SetStringSelection(selected_style)) { if (StorageList->GetCount() && StorageList->SetStringSelection(selected_style)) {
@ -741,6 +771,7 @@ void DialogStyleManager::OnStorageNew (wxCommandEvent &) {
Store.style.push_back(temp); Store.style.push_back(temp);
Store.Save(CatalogList->GetString(CatalogList->GetSelection())); Store.Save(CatalogList->GetString(CatalogList->GetSelection()));
LoadStorageStyles(); LoadStorageStyles();
StorageList->SetStringSelection(temp->name);
} }
else delete temp; else delete temp;
UpdateMoveButtons(); UpdateMoveButtons();
@ -755,6 +786,7 @@ void DialogStyleManager::OnCurrentNew (wxCommandEvent &) {
if (modified) { if (modified) {
grid->ass->InsertStyle(temp); grid->ass->InsertStyle(temp);
LoadCurrentStyles(grid->ass); LoadCurrentStyles(grid->ass);
CurrentList->SetStringSelection(temp->name);
} }
else delete temp; else delete temp;
UpdateMoveButtons(); UpdateMoveButtons();

View File

@ -208,92 +208,6 @@ public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
///////
// IDs
enum {
/// DOCME
BUTTON_CATALOG_NEW = 1000,
/// DOCME
BUTTON_CATALOG_DELETE,
/// DOCME
BUTTON_STORAGE_COPYTO,
/// DOCME
BUTTON_STORAGE_NEW,
/// DOCME
BUTTON_STORAGE_EDIT,
/// DOCME
BUTTON_STORAGE_COPY,
/// DOCME
BUTTON_STORAGE_DELETE,
/// DOCME
BUTTON_STORAGE_UP,
/// DOCME
BUTTON_STORAGE_DOWN,
/// DOCME
BUTTON_STORAGE_TOP,
/// DOCME
BUTTON_STORAGE_BOTTOM,
/// DOCME
BUTTON_STORAGE_SORT,
/// DOCME
BUTTON_CURRENT_COPYTO,
/// DOCME
BUTTON_CURRENT_NEW,
/// DOCME
BUTTON_CURRENT_EDIT,
/// DOCME
BUTTON_CURRENT_COPY,
/// DOCME
BUTTON_CURRENT_DELETE,
/// DOCME
BUTTON_CURRENT_IMPORT,
/// DOCME
BUTTON_CURRENT_UP,
/// DOCME
BUTTON_CURRENT_DOWN,
/// DOCME
BUTTON_CURRENT_TOP,
/// DOCME
BUTTON_CURRENT_BOTTOM,
/// DOCME
BUTTON_CURRENT_SORT,
/// DOCME
LIST_CATALOG,
/// DOCME
LIST_STORAGE,
/// DOCME
LIST_CURRENT
};
/// DOCME /// DOCME
/// @class DialogStyleManagerEvent /// @class DialogStyleManagerEvent
/// @brief DOCME /// @brief DOCME