// On tab selection, we save the data for the tab which is losing selection and // load the data of the selected tab into the WindowInfo. LRESULT TabsOnNotify(WindowInfo *win, LPARAM lparam, int tab1, int tab2) { LPNMHDR data = (LPNMHDR)lparam; int current; switch(data->code) { case TCN_SELCHANGING: // TODO: Should we allow the switch of the tab if we are in process of printing? SaveCurrentTabInfo(win); return FALSE; case TCN_SELCHANGE: current = TabCtrl_GetCurSel(win->hwndTabBar); LoadModelIntoTab(win, win->tabs.At(current)); break; case T_CLOSING: // allow the closure return FALSE; case T_CLOSE: current = TabCtrl_GetCurSel(win->hwndTabBar); if (tab1 == current) CloseTab(win); else RemoveTab(win, tab1); break; case T_DRAG: SwapTabs(win, tab1, tab2); break; } return TRUE; }
// On tab selection, we save the data for the tab which is losing selection and // load the data of the selected tab into the WindowInfo. LRESULT TabsOnNotify(WindowInfo *win, LPARAM lparam, int tab1, int tab2) { LPNMHDR data = (LPNMHDR)lparam; switch(data->code) { case TCN_SELCHANGING: // TODO: Should we allow the switch of the tab if we are in process of printing? SaveCurrentTabInfo(win); return FALSE; case TCN_SELCHANGE: { int current = TabCtrl_GetCurSel(win->hwndTabBar); LoadModelIntoTab(win, win->tabs.At(current)); } break; case T_CLOSING: // allow the closure return FALSE; case T_CLOSE: { int current = TabCtrl_GetCurSel(win->hwndTabBar); if (tab1 == current) { CloseTab(win); } else { TabInfo *tdata = win->tabs.At(tab1); UpdateTabFileDisplayStateForWin(win, tdata); win->tabSelectionHistory->Remove(tdata); win->tabs.Remove(tdata); delete tdata; TabCtrl_DeleteItem(win->hwndTabBar, tab1); UpdateTabWidth(win); } } break; case T_DRAG: SwapTabs(win, tab1, tab2); break; } return TRUE; }