Changeset d7b53e3 in git


Ignore:
Timestamp:
06/03/15 03:28:26 (5 years ago)
Author:
Olly Betts <olly@…>
Branches:
line_contents, master, stereo, travis-osx
Children:
0e81a88
Parents:
bfd5706
git-author:
Olly Betts <olly@…> (06/03/15 03:26:26)
git-committer:
Olly Betts <olly@…> (06/03/15 03:28:26)
Message:

lib/icons/Makefile.am,lib/icons/log.xpm,lib/survex.pot,src/: Add a
menu item and toolbar button to show the cavern log window if the
currently shown survey data was processed by aven. Reported by
Hugh St Lawrence in #47, and by Dave Clucas and others previously on
the list.

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rbfd5706 rd7b53e3  
     1Fri Mar 06 03:24:54 GMT 2015  Olly Betts <olly@survex.com>
     2
     3        * lib/icons/Makefile.am,lib/icons/log.xpm,lib/survex.pot,src/: Add a
     4          menu item and toolbar button to show the cavern log window if the
     5          currently shown survey data was processed by aven.  Reported by
     6          Hugh St Lawrence in #47, and by Dave Clucas and others previously on
     7          the list.
     8
    19Fri Mar 06 01:24:57 GMT 2015  Olly Betts <olly@survex.com>
    210
  • lib/icons/Makefile.am

    rbfd5706 rd7b53e3  
    33xpm_files = \
    44        aven.xpm \
     5        log.xpm \
    56        open.xpm \
    67        open_pres.xpm \
  • lib/survex.pot

    rbfd5706 rd7b53e3  
    16541654#: n:269
    16551655msgid "[SURVEY_FILE]"
    1656 msgstr ""
    1657 
    1658 #. TRANSLATORS: Aven menu items.  An “&” goes before the letter of any
    1659 #. accelerator key.
    1660 #.
    1661 #. The string "\t" separates the menu text and any accelerator key.
    1662 #.
    1663 #. "File" menu.  The accelerators must be different within this group.
    1664 #. c.f. 201, 380, 381.
    1665 #: ../src/mainfrm.cc:795
    1666 #: n:220
    1667 msgid "&Open…\tCtrl+O"
    16681656msgstr ""
    16691657
     
    26552643msgstr ""
    26562644
     2645#. TRANSLATORS: Aven menu items.  An “&” goes before the letter of any
     2646#. accelerator key.
     2647#.
     2648#. The string "\t" separates the menu text and any accelerator key.
     2649#.
     2650#. "File" menu.  The accelerators must be different within this group.
     2651#. c.f. 201, 380, 381.
     2652#: ../src/mainfrm.cc:795
     2653#: n:220
     2654msgid "&Open…\tCtrl+O"
     2655msgstr ""
     2656
     2657#: ../src/mainfrm.cc:796
     2658#: n:144
     2659msgid "Show &Log"
     2660msgstr ""
     2661
    26572662#: ../src/mainfrm.cc:798
    26582663#: n:380
  • src/cavernlog.cc

    rbfd5706 rd7b53e3  
    8989}
    9090
    91 CavernLogWindow::CavernLogWindow(MainFrm * mainfrm_, wxWindow * parent)
    92     : wxHtmlWindow(parent), mainfrm(mainfrm_)
     91CavernLogWindow::CavernLogWindow(MainFrm * mainfrm_, const wxString & survey_, wxWindow * parent)
     92    : wxHtmlWindow(parent), mainfrm(mainfrm_), init_done(false), survey(survey_)
    9393{
    9494    int fsize = parent->GetFont().GetPointSize();
     
    460460        return -1;
    461461    }
    462     if (link_count) {
    463         AppendToPage(wxString::Format(wxT("<avenbutton id=1234 name=\"%s\">"),
    464                                       wmsg(/*Reprocess*/184).c_str()));
    465         AppendToPage(wxString::Format(wxT("<avenbutton default id=%d>"), (int)wxID_OK));
    466         Update();
    467     }
     462    AppendToPage(wxString::Format(wxT("<avenbutton id=1234 name=\"%s\">"),
     463                                  wmsg(/*Reprocess*/184).c_str()));
     464    AppendToPage(wxString::Format(wxT("<avenbutton default id=%d>"), (int)wxID_OK));
     465    Update();
     466    init_done = false;
    468467    return link_count;
    469468}
     
    473472{
    474473    SetPage(wxString());
    475     if (process(filename) == 0) {
     474    int result = process(filename);
     475    if (result < 0) return;
     476    mainfrm->AddToFileHistory(filename);
     477    wxString file3d(filename, 0, filename.length() - 3);
     478    file3d.append(wxT("3d"));
     479    if (!mainfrm->LoadData(file3d, survey)) {
     480        return;
     481    }
     482    if (result == 0) {
    476483        OnOK(e);
    477484    }
     
    481488CavernLogWindow::OnOK(wxCommandEvent &)
    482489{
    483     mainfrm->InitialiseAfterLoad(filename);
    484 }
     490    if (init_done) {
     491        mainfrm->HideLog(this);
     492    } else {
     493        mainfrm->InitialiseAfterLoad(filename);
     494        init_done = true;
     495    }
     496}
  • src/cavernlog.h

    rbfd5706 rd7b53e3  
    3232    MainFrm * mainfrm;
    3333
     34    bool init_done;
     35
     36    wxString survey;
     37
    3438  public:
    35     CavernLogWindow(MainFrm * mainfrm_, wxWindow * parent);
     39    CavernLogWindow(MainFrm * mainfrm_, const wxString & survey_, wxWindow * parent);
    3640
    3741    /** Process survey data in file.
  • src/mainfrm.cc

    rbfd5706 rd7b53e3  
    6161#define static static const
    6262#include "../lib/icons/aven.xpm"
     63#include "../lib/icons/log.xpm"
    6364#include "../lib/icons/open.xpm"
    6465#include "../lib/icons/open_pres.xpm"
     
    516517
    517518    EVT_MENU(wxID_OPEN, MainFrm::OnOpen)
     519    EVT_MENU(menu_FILE_LOG, MainFrm::OnShowLog)
    518520    EVT_MENU(wxID_PRINT, MainFrm::OnPrint)
    519521    EVT_MENU(menu_FILE_PAGE_SETUP, MainFrm::OnPageSetup)
     
    613615    EVT_MENU(wxID_ABOUT, MainFrm::OnAbout)
    614616
     617    EVT_UPDATE_UI(menu_FILE_LOG, MainFrm::OnShowLogUpdate)
    615618    EVT_UPDATE_UI(wxID_PRINT, MainFrm::OnPrintUpdate)
    616619    EVT_UPDATE_UI(menu_FILE_SCREENSHOT, MainFrm::OnScreenshotUpdate)
     
    737740    wxFrame(NULL, 101, title, pos, size, wxDEFAULT_FRAME_STYLE),
    738741    m_SashPosition(-1),
    739     m_Gfx(NULL), m_NumEntrances(0), m_NumFixedPts(0), m_NumExportedPts(0),
     742    m_Gfx(NULL), m_Log(NULL),
     743    m_NumEntrances(0), m_NumFixedPts(0), m_NumExportedPts(0),
    740744    m_NumHighlighted(0),
    741745    m_HasUndergroundLegs(false), m_HasSplays(false), m_HasSurfaceLegs(false),
     
    794798     * c.f. 201, 380, 381. */
    795799    filemenu->Append(wxID_OPEN, wmsg(/*&Open…\tCtrl+O*/220));
     800    filemenu->Append(menu_FILE_LOG, wmsg(/*Show &Log*/144));
    796801    filemenu->AppendSeparator();
    797802    // wxID_PRINT stock label lacks the ellipses
     
    9971002    toolbar->AddTool(wxID_OPEN, wxT("Open"), TOOL(open), wxT("Open a survey file for viewing"));
    9981003    toolbar->AddTool(menu_PRES_OPEN, wxT("Open presentation"), TOOL(open_pres), wxT("Open a presentation"));
     1004    toolbar->AddTool(menu_FILE_LOG, wxT("View log"), TOOL(log), wxT("View log from processing survey data"));
    9991005    toolbar->AddSeparator();
    10001006    toolbar->AddCheckTool(menu_ROTATION_TOGGLE, wxT("Toggle rotation"), TOOL(rotation), wxNullBitmap, wxT("Toggle rotation"));
     
    14931499    SetTitle(m_Title + " - "APP_NAME);
    14941500
     1501    // Sort the labels ready for filling the tree.
     1502    m_Labels.sort(LabelCmp(separator));
     1503
     1504    // Fill the tree of stations and prefixes.
     1505    FillTree(wxFileNameFromPath(file));
     1506
     1507    // Sort labels so that entrances are displayed in preference,
     1508    // then fixed points, then exported points, then other points.
     1509    //
     1510    // Also sort by leaf name so that we'll tend to choose labels
     1511    // from different surveys, rather than labels from surveys which
     1512    // are earlier in the list.
     1513    m_Labels.sort(LabelPlotCmp(separator));
     1514
     1515    if (!m_FindBox->GetValue().empty()) {
     1516        // Highlight any stations matching the current search.
     1517        DoFind();
     1518    }
     1519
    14951520    return true;
    14961521}
     
    15671592#endif
    15681593
    1569 void MainFrm::FillTree()
     1594void MainFrm::FillTree(const wxString & root_name)
    15701595{
    15711596    // Create the root of the tree.
    1572     wxTreeItemId treeroot = m_Tree->AddRoot(wxFileNameFromPath(m_File));
     1597    wxTreeItemId treeroot = m_Tree->AddRoot(root_name);
    15731598
    15741599    // Fill the tree of stations and prefixes.
     
    17731798        ext.MakeLower();
    17741799        if (ext == wxT("svx") || ext == wxT("dat") || ext == wxT("mak")) {
    1775             CavernLogWindow * log = new CavernLogWindow(this, m_Splitter);
     1800            CavernLogWindow * log = new CavernLogWindow(this, survey, m_Splitter);
    17761801            wxWindow * win = m_Splitter->GetWindow1();
    17771802            m_Splitter->ReplaceWindow(win, log);
     
    18041829    AddToFileHistory(file);
    18051830    InitialiseAfterLoad(file);
     1831
     1832    // If aven is showing the log for a .svx file and you load a .3d file, then
     1833    // at this point m_Log will be the log window for the .svx file, so destroy
     1834    // it - it should never legitimately be set if we get here.
     1835    if (m_Log) {
     1836        m_Log->Destroy();
     1837        m_Log = NULL;
     1838    }
    18061839}
    18071840
     
    18281861        m_File = file;
    18291862
    1830     // Sort the labels ready for filling the tree.
    1831     m_Labels.sort(LabelCmp(separator));
    1832 
    1833     // Fill the tree of stations and prefixes.
    1834     FillTree();
    1835 
    1836     // Sort labels so that entrances are displayed in preference,
    1837     // then fixed points, then exported points, then other points.
    1838     //
    1839     // Also sort by leaf name so that we'll tend to choose labels
    1840     // from different surveys, rather than labels from surveys which
    1841     // are earlier in the list.
    1842     m_Labels.sort(LabelPlotCmp(separator));
    1843 
    1844     if (!m_FindBox->GetValue().empty()) {
    1845         // Highlight any stations matching the current search.
    1846         DoFind();
    1847     }
    1848 
    18491863    wxWindow * win = NULL;
    18501864    if (m_Splitter->GetWindow2() == NULL) {
     
    18601874
    18611875    m_Gfx->Initialise(same_file);
     1876
     1877    if (win) {
     1878        // FIXME: check it actually is the log window!
     1879        if (m_Log && m_Log != win)
     1880            m_Log->Destroy();
     1881        m_Log = win;
     1882        m_Log->Show(false);
     1883    }
     1884
    18621885    if (!IsFullScreen()) {
    18631886        m_Notebook->Show(true);
     
    18661889    m_Gfx->Show(true);
    18671890    m_Gfx->SetFocus();
    1868 
    1869     if (win) win->Destroy();
     1891}
     1892
     1893void MainFrm::HideLog(wxWindow * log_window)
     1894{
     1895    if (!IsFullScreen()) {
     1896        m_Splitter->SplitVertically(m_Notebook, m_Gfx, m_SashPosition);
     1897    }
     1898
     1899    m_Log = log_window;
     1900    m_Log->Show(false);
     1901
     1902    if (!IsFullScreen()) {
     1903        m_Notebook->Show(true);
     1904    }
     1905
     1906    m_Gfx->Show(true);
     1907    m_Gfx->SetFocus();
    18701908}
    18711909
     
    19341972}
    19351973
     1974void MainFrm::OnShowLog(wxCommandEvent&)
     1975{
     1976    if (!m_Log) return;
     1977    wxWindow * win = m_Splitter->GetWindow1();
     1978    m_Splitter->ReplaceWindow(win, m_Log);
     1979    if (m_Splitter->IsSplit()) {
     1980        m_SashPosition = m_Splitter->GetSashPosition(); // save width of panel
     1981        m_Splitter->Unsplit();
     1982    }
     1983    m_Log->Show(true);
     1984    m_Log->SetFocus();
     1985    m_Log = NULL;
     1986}
     1987
    19361988void MainFrm::OnScreenshot(wxCommandEvent&)
    19371989{
  • src/mainfrm.h

    rbfd5706 rd7b53e3  
    5555
    5656enum {
    57     menu_FILE_PAGE_SETUP = 1000,
     57    menu_FILE_LOG = 1000,
     58    menu_FILE_PAGE_SETUP,
    5859    menu_FILE_SCREENSHOT,
    5960    menu_FILE_EXPORT,
     
    189190    bool complete_dateinfo;
    190191    GfxCore* m_Gfx;
     192    wxWindow* m_Log;
    191193    GUIControl* m_Control;
    192194    int m_NumEntrances;
     
    222224#endif
    223225
    224     void FillTree();
     226    void FillTree(const wxString & root_name);
    225227    bool ProcessSVXFile(const wxString & file);
    226     bool LoadData(const wxString& file, const wxString& prefix);
    227228//    void FixLRUD(traverse & centreline);
    228229    void CentreDataset(const Vector3 & vmin);
     
    234235    void UpdateStatusBar();
    235236
    236     void AddToFileHistory(const wxString & file);
    237 
    238237public:
    239238    MainFrm(const wxString& title, const wxPoint& pos, const wxSize& size);
    240239
     240    // public for CavernLog.
     241    bool LoadData(const wxString& file, const wxString& prefix);
     242    void AddToFileHistory(const wxString & file);
     243
    241244    void InitialiseAfterLoad(const wxString & file);
     245    void OnShowLog(wxCommandEvent& event);
    242246
    243247    void OnMRUFile(wxCommandEvent& event);
     
    268272
    269273    void OnOpen(wxCommandEvent& event);
     274    void HideLog(wxWindow * log_window);
    270275    void OnScreenshot(wxCommandEvent& event);
    271276    void OnScreenshotUpdate(wxUpdateUIEvent& event);
     
    304309    }
    305310
     311    void OnShowLogUpdate(wxUpdateUIEvent &ui) { ui.Enable(m_Log != NULL); }
    306312    void OnPrintUpdate(wxUpdateUIEvent &ui) { ui.Enable(!m_File.empty()); }
    307313    void OnExportUpdate(wxUpdateUIEvent &ui) { ui.Enable(!m_File.empty()); }
Note: See TracChangeset for help on using the changeset viewer.