//--------------------------------------------------------- int CWKSP_Tool_Manager::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter, int Flags) { //----------------------------------------------------- if( Flags & PARAMETER_CHECK_VALUES ) { if( g_pSAGA_Frame && g_pData ) { if( !SG_STR_CMP(pParameter->Get_Identifier(), "LNG_OLDSTYLE") || !SG_STR_CMP(pParameter->Get_Identifier(), "LNG_FILE_DIC") || !SG_STR_CMP(pParameter->Get_Identifier(), "CRS_FILE_SRS") || !SG_STR_CMP(pParameter->Get_Identifier(), "CRS_FILE_DIC") || !SG_STR_CMP(pParameter->Get_Identifier(), "LOOK_TB_SIZE") ) { if( DLG_Message_Confirm(_TL("Restart now ?"), _TL("Restart SAGA to apply the changes")) && g_pData->Close(true) ) { m_Parameters.Assign_Values(pParameters); g_pSAGA_Frame->Close(true); } } } } //----------------------------------------------------- return( CWKSP_Base_Manager::On_Parameter_Changed(pParameters, pParameter, Flags) ); }
//--------------------------------------------------------- bool CWKSP_Shapes::_Edit_Shape_Del(void) { if( DLG_Message_Confirm(_TL("Delete selected shape(s)."), _TL("Edit Shapes")) ) { if( Get_Shapes()->Get_Selection_Count() > 0 ) { if( m_Edit_pShape ) { _Edit_Shape_Stop(false); Get_Shapes()->Del_Shape(Get_Shapes()->Get_Selection(m_Edit_Index)); } else { Get_Shapes()->Del_Selection(); } Edit_Set_Index(0); Update_Views(); return( true ); } return( _Edit_Shape_Stop(false) ); } return( false ); }
//--------------------------------------------------------- void CSAGA_Frame::On_Close(wxCloseEvent &event) { if( event.CanVeto() ) { if( !g_pModule && DLG_Message_Confirm(ID_DLG_CLOSE) && g_pData->Close(true) ) { g_pModules->Finalise(); Destroy(); } else { if( g_pModule ) { DLG_Message_Show(_TL("Please stop tool execution before exiting SAGA."), _TL("Exit SAGA")); } event.Veto(); } } else { g_pModules->Finalise(); g_pData->Close(true); event.Skip(); } }
//--------------------------------------------------------- void CACTIVE_Attributes::Save_Changes(bool bConfirm) { if( m_pItem && m_pAttributes->is_Modified() && (!bConfirm || DLG_Message_Confirm(_TL("Save changes?"), _TL("Attributes"))) ) { m_pItem->Edit_Get_Attributes()->Assign_Values(m_pAttributes); m_pItem->Edit_Set_Attributes(); Set_Attributes(); } }
//--------------------------------------------------------- bool CParameters_Control::Save_Changes(bool bSilent) { if( m_pOriginal && m_bModified && (bSilent || DLG_Message_Confirm(_TL("Save changes?"), wxString::Format(wxT("%s: %s"), _TL("Parameters"), m_pParameters->Get_Name().w_str()))) ) { m_pOriginal->Assign_Values(m_pParameters); m_bModified = false; m_pPG->ClearModifiedStatus(); m_pPG->Refresh(); return( true ); } return( false ); }
//--------------------------------------------------------- bool CWKSP_Shapes::_Edit_Shape_Stop(void) { return( _Edit_Shape_Stop(DLG_Message_Confirm(_TL("Apply changes?"), _TL("Edit Shapes"))) ); }
bool DLG_Message_Confirm(int ID_DLG) { return( DLG_Message_Confirm(DLG_Get_Text(ID_DLG), DLG_Get_Caption(ID_DLG)) ); }
//--------------------------------------------------------- int Callback(TSG_UI_Callback_ID ID, CSG_UI_Parameter &Param_1, CSG_UI_Parameter &Param_2) { int Result, *iArray; Result = 1; //----------------------------------------------------- switch( ID ) { default: Result = 0; break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_PROCESS_GET_OKAY: Result = PROCESS_Get_Okay(Param_1.True); break; //----------------------------------------------------- case CALLBACK_PROCESS_SET_OKAY: Result = PROCESS_Set_Okay(Param_1.True); break; //----------------------------------------------------- case CALLBACK_PROCESS_SET_PROGRESS: Result = PROGRESSBAR_Set_Position(Param_1.Number, Param_2.Number); break; //----------------------------------------------------- case CALLBACK_PROCESS_SET_READY: STATUSBAR_Set_Text(_TL("ready")); Result = PROGRESSBAR_Set_Position(0); break; //----------------------------------------------------- case CALLBACK_PROCESS_SET_TEXT: STATUSBAR_Set_Text(Param_1.String.c_str()); break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_STOP_EXECUTION: if( g_pModule && g_pModule->is_Executing() ) { Result = g_pModule->Execute(Param_1.True) ? 1 : 0; } else if( g_pModule && g_pModule->is_Interactive() ) { Result = g_pModule->Execute(Param_1.True) ? 1 : 0; } break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_MESSAGE_ADD: iArray = (int *)Param_2.Pointer; MSG_General_Add (Param_1.String.c_str(), iArray[0] != 0, iArray[0] != 0, (TSG_UI_MSG_STYLE)iArray[1]); break; //----------------------------------------------------- case CALLBACK_MESSAGE_ADD_ERROR: MSG_Error_Add (Param_1.String.c_str(), true); break; //----------------------------------------------------- case CALLBACK_MESSAGE_ADD_EXECUTION: iArray = (int *)Param_2.Pointer; MSG_Execution_Add (Param_1.String.c_str(), iArray[0] != 0, iArray[0] != 0, (TSG_UI_MSG_STYLE)iArray[1]); break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_DLG_MESSAGE: DLG_Message_Show(Param_1.String.c_str(), Param_2.String.c_str()); break; //----------------------------------------------------- case CALLBACK_DLG_CONTINUE: Result = DLG_Message_Confirm(Param_1.String.c_str(), Param_2.String.c_str()); break; //----------------------------------------------------- case CALLBACK_DLG_ERROR: Result = DLG_Message_Show_Error(Param_1.String.c_str(), Param_2.String.c_str()); break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_DLG_PARAMETERS: Result = DLG_Parameters((CSG_Parameters *)Param_1.Pointer, Param_2.String.c_str()) ? 1 : 0; break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_DATAOBJECT_ADD: Result = g_pData->Add((CSG_Data_Object *)Param_1.Pointer) ? 1 : 0; if( Result && Param_2.True ) { g_pData->Show((CSG_Data_Object *)Param_1.Pointer, false); } break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_UPDATE: Result = g_pData->Update((CSG_Data_Object *)Param_1.Pointer, (CSG_Parameters *)Param_2.Pointer) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_SHOW: Result = g_pData->Show((CSG_Data_Object *)Param_1.Pointer, (int)Param_2.Number) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_ASIMAGE: Result = g_pData->asImage((CSG_Data_Object *)Param_1.Pointer, (CSG_Grid *)Param_2.Pointer) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_COLORS_GET: Result = g_pData->Get_Colors((CSG_Data_Object *)Param_1.Pointer, (CSG_Colors *)Param_2.Pointer) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_COLORS_SET: Result = g_pData->Set_Colors((CSG_Data_Object *)Param_1.Pointer, (CSG_Colors *)Param_2.Pointer) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_PARAMS_GET: Result = g_pData->Get_Parameters((CSG_Data_Object *)Param_1.Pointer, (CSG_Parameters *)Param_2.Pointer) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_DATAOBJECT_PARAMS_SET: Result = g_pData->Set_Parameters((CSG_Data_Object *)Param_1.Pointer, (CSG_Parameters *)Param_2.Pointer) ? 1 : 0; break; //----------------------------------------------------- case CALLBACK_ODBC_UPDATE: Result = g_pData_Source->Update_ODBC_Source(Param_1.String.c_str()) ? 1 : 0; break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- case CALLBACK_GUI_GET_WINDOW: Param_1.Pointer = MDI_Get_Frame(); break; /////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////// //----------------------------------------------------- } return( Result ); }
//--------------------------------------------------------- void CData_Source_PgSQL::Table_Drop(const wxTreeItemId &Item) { CData_Source_PgSQL_Data *pData = Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL ) return; wxString Name = GetItemText(Item); switch( pData->Get_Type() ) { //----------------------------------------------------- case TYPE_GRID: if( DLG_Message_Confirm(wxString::Format("%s [%s]", _TL("Do you really want to delete this raster band"), Name.c_str()), _TL("Raster Band Deletion")) ) { MSG_General_Add(wxString::Format("%s: [%s] %s...", _TL("Deleting raster band"), pData->Get_Server().c_str(), Name.c_str()), true, true); CSG_String Table = pData->Get_Value().BeforeFirst(':'); CSG_String rid = pData->Get_Value().AfterFirst (':'); CSG_String SQL = "DELETE FROM \"" + Table + "\" WHERE " + rid + ";"; RUN_MODULE(DB_PGSQL_Execute_SQL, false, SET_PARAMETER("CONNECTION", pData->Get_Server()) && SET_PARAMETER("SQL" , SQL) ); if( bResult ) { Delete(Item); MSG_General_Add(_TL("okay"), false, false, SG_UI_MSG_STYLE_SUCCESS); } else { MSG_General_Add(_TL("failed"), false, false, SG_UI_MSG_STYLE_FAILURE); } } break; //----------------------------------------------------- default: if( DLG_Message_Confirm(wxString::Format("%s [%s]", _TL("Do you really want to delete the table"), pData->Get_Value().c_str()), _TL("Table Deletion")) ) { MSG_General_Add(wxString::Format("%s: [%s] %s...", _TL("Deleting table"), pData->Get_Server().c_str(), pData->Get_Value().c_str()), true, true); RUN_MODULE(DB_PGSQL_Table_Drop, false, // CTable_Drop SET_PARAMETER("CONNECTION", pData->Get_Server()) && SET_PARAMETER("TABLES" , pData->Get_Value()) ); if( bResult ) { Delete(Item); MSG_General_Add(_TL("okay"), false, false, SG_UI_MSG_STYLE_SUCCESS); } else { MSG_General_Add(_TL("failed"), false, false, SG_UI_MSG_STYLE_FAILURE); } } break; } }