Changeset 647

Show
Ignore:
Timestamp:
11/19/06 23:32:53 (2 years ago)
Author:
leo
Message:

Implemented adding/removing new models.

Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/common/project.cpp

    r646 r647  
    142142    UpdateSelection(); 
    143143    SystemUpdateTime(false, m_ActiveModel->m_CurFrame, 255); 
     144    SystemUpdateModelMenu(m_ModelList, m_ActiveModel); 
    144145 
    145146    for (int i = 0; i < m_ViewList.GetSize(); i++) 
     
    220221 
    221222    m_ActiveModel = NULL; 
     223    SystemUpdateModelMenu(m_ModelList, m_ActiveModel); 
    222224 
    223225    for (i = 0; i < LC_CONNECTIONS; i++) 
     
    324326    m_ActiveModel = new lcModel("Main"); 
    325327    m_ModelList.Add(m_ActiveModel); 
     328    SystemUpdateModelMenu(m_ModelList, m_ActiveModel); 
    326329 
    327330    for (i = 0; i < m_ViewList.GetSize (); i++) 
     
    44064409        case LC_MODEL_NEW: 
    44074410        { 
     4411            int Max = 0; 
     4412 
     4413            // Find out the number of the last model added. 
     4414            for (int i = 0; i < m_ModelList.GetSize(); i++) 
     4415            { 
     4416                int Num; 
     4417 
     4418                if (sscanf((char*)m_ModelList[i]->GetName(), "New Model %d", &Num) == 1) 
     4419                    if (Num > Max) 
     4420                        Max = Num; 
     4421            } 
     4422 
     4423            char Name[256]; 
     4424            sprintf(Name, "New Model %d", Max + 1); 
     4425 
     4426            // Create and add new model. 
     4427            lcModel* Model = new lcModel(Name); 
     4428            m_ModelList.Add(Model); 
     4429            m_ActiveModel = Model; 
     4430 
     4431            SetModifiedFlag(true); 
     4432            CheckPoint("Adding Model"); 
     4433            SystemUpdateModelMenu(m_ModelList, m_ActiveModel); 
     4434            UpdateAllViews(); 
    44084435        } break; 
    44094436 
    44104437        case LC_MODEL_DELETE: 
    44114438        { 
     4439            // Make sure we aren't deleting the last model. 
     4440            if (m_ModelList.GetSize() < 2) 
     4441            { 
     4442                SystemDoMessageBox("Projects must have at least 1 model.", LC_MB_OK | LC_MB_ICONINFORMATION); 
     4443                break; 
     4444            } 
     4445 
     4446            // Ask the user if he really wants to delete this model. 
     4447            char* Text = new char[m_ActiveModel->GetName().GetLength() + 100]; 
     4448            sprintf(Text, "Are you sure you want to delete the model \"%s\"?", (char*)m_ActiveModel->GetName()); 
     4449 
     4450            if (SystemDoMessageBox(Text, LC_MB_YESNO | LC_MB_ICONQUESTION) == LC_YES) 
     4451            { 
     4452                m_ModelList.RemovePointer(m_ActiveModel); 
     4453                delete m_ActiveModel; 
     4454                m_ActiveModel = m_ModelList[0]; 
     4455 
     4456                SetModifiedFlag(true); 
     4457                CheckPoint("Deleting Model"); 
     4458                SystemUpdateModelMenu(m_ModelList, m_ActiveModel); 
     4459            } 
     4460 
     4461            delete[] Text; 
    44124462        } break; 
    44134463 
  • trunk/win/LeoCAD.rc

    r646 r647  
    932932END 
    933933 
    934 IDD_GROUP DIALOG  0, 0, 170, 45 
     934IDD_GROUP DIALOGEX 0, 0, 170, 45 
    935935STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 
    936936CAPTION "Group Name" 
    937 FONT 8, "MS Sans Serif" 
     937FONT 8, "MS Sans Serif", 0, 0, 0x0 
    938938BEGIN 
    939939    EDITTEXT        IDC_GRPDLG_NAME,15,17,90,10,ES_AUTOHSCROLL 
  • trunk/win/System.cpp

    r646 r647  
    881881        return; 
    882882 
     883    if (ModelList.GetSize() > 1) 
     884        Menu->EnableMenuItem(ID_MODEL_DELETE, MF_BYCOMMAND | MF_ENABLED); 
     885    else 
     886        Menu->EnableMenuItem(ID_MODEL_DELETE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); 
     887 
    883888    // Delete existing entries. 
    884889    for (int i = 1; i < LC_MODEL_MENU_MAX; i++) 
  • trunk/win/resource.h

    r646 r647  
    7070#define IDC_PAN_ALL                     169 
    7171#define IDD_GROUP                       170 
     72#define IDD_NAME                        170 
    7273#define IDB_HELP                        172 
    7374#define IDB_HOME                        173