Exemplo n.º 1
0
// Called when we're closing a document
void TabsOnCloseDoc(WindowInfo *win)
{
    if (win->tabs.Count() == 0)
        return;

    /* if (win->AsFixed() && win->AsFixed()->userAnnots && win->AsFixed()->userAnnotsModified) {
        // TODO: warn about unsaved changes
    } */

    int current = TabCtrl_GetCurSel(win->hwndTabBar);
    TabInfo *tdata = win->currentTab;
    UpdateTabFileDisplayStateForWin(win, tdata);
    win->tabSelectionHistory->Remove(tdata);
    win->tabs.Remove(tdata);
    delete tdata;
    TabCtrl_DeleteItem(win->hwndTabBar, current);
    win->loadedFilePath = nullptr;
    win->ctrl = nullptr;
    win->currentTab = nullptr;
    UpdateTabWidth(win);

    if (win->tabs.Count() > 0) {
        tdata = win->tabSelectionHistory->Pop();
        TabCtrl_SetCurSel(win->hwndTabBar, win->tabs.Find(tdata));
        LoadModelIntoTab(win, tdata);
    }
}
Exemplo n.º 2
0
/// Function name  : removeDocument
// Description     : Removes the destroys the specified document. Should not be called directly, except by 'closeDocumentByIndex'
// 
// DOCUMENTS_DATA*  pWindowData : [in] Documents window data
// DOCUMENT*        pDocument   : [in] Target document
// CONST UINT       iIndex      : [in] Index of target document
// 
VOID  removeDocument(DOCUMENTS_DATA*  pWindowData, DOCUMENT*  pDocument, CONST UINT  iIndex)
{
   UINT   iReplacementIndex;    // Index of document to display instead

   
   // [CHECK] Are we closing the ActiveDocument?
   if (pDocument == getActiveDocument())
   {
      // [CHECK] Is there a replacement for the ActiveDocument?
      if (getDocumentCount() > 1)
      {
         // [SUCCESS] Display document on the right, otherwise one on the left
         iReplacementIndex = (iIndex == getDocumentCount() - 1 ? (iIndex - 1) : (iIndex + 1));
         displayDocumentByIndex(pWindowData->hTabCtrl, iReplacementIndex);       /// [EVENT] Fires UM_DOCUMENT_SWITCHED
      }
      else
         // [FAILED] Reset active document
         setActiveDocument(pWindowData, NULL);     /// [EVENT] Fires UM_DOCUMENT_SWITCHED
   }

   /// Remove tab and Destroy Document
   TabCtrl_DeleteItem(pWindowData->hTabCtrl, iIndex);        // [WARNING] TabCtrl_DeleteItem causes document to be erased but not invalidated
   removeObjectFromListByValue(pWindowData->pDocumentList, (LPARAM)pDocument);
   deleteDocument(pDocument);

   // [CHECK] Is there an active document?
   if (getActiveDocument())
      // [ACTIVE DOCUMENT] Resize in case a row of tabs has been removed
      updateDocumentSize(pWindowData, getActiveDocument());
}
Exemplo n.º 3
0
//删除Item
void SiTabCtl_DelItem(HWND hwnd)
{
	int idx = SiTabCtl_FindItem(hwnd);
	if(idx == -1)
		return;
	TabCtrl_DeleteItem(hwnd_tab_ctl,idx);
}
Exemplo n.º 4
0
//
//	Called when the dockpanel receivees a WM_NOTIFY from one of its child-windows
//  i.e. either the TabView, or one of the DOCKWND's
//
LRESULT DockPanel_OnNotify(DOCKPANEL *dpp, WPARAM wParam, NMHDR *hdr)
{
	// notification message from the TabView
	if(hdr->hwndFrom == dpp->hwndTabView)
	{
		TCITEM tci = { TCIF_PARAM };
		DOCKWND *dwp;

		// get the active selection
		int iItem = TabCtrl_GetCurSel(dpp->hwndTabView);

		// every tab-item's lParam is a dockwindow-ID
		TabCtrl_GetItem(dpp->hwndTabView, iItem, &tci);

		switch(hdr->code)
		{
		case TCN_SELCHANGE:
			// show the appropriate DOCKWND
			DockWnd_Show(dpp->hwndMain, (UINT)tci.lParam, TRUE);
			break;

		case TCN_CLOSE:
			// hide the DOCKWND
			DockWnd_Show(dpp->hwndMain, (UINT)tci.lParam, FALSE);

			// delete the tab
			TabCtrl_DeleteItem(dpp->hwndTabView, iItem);
			break;

		case TCN_MOUSELEAVE:
			// the mouse has moved outside of the tab,
			// whilst being clicked - so we need to drag
			// the tab off into its own floating dock-window
			dwp = DOCKWNDFromId(dpp->hwndMain, (UINT)tci.lParam);
			
			if(dpp->WndListHead->flink == dwp && dpp->WndListTail->blink == dwp)
			{
				// if this is the last tab, then do a normal undock
				SendMessage(dpp->hwndTabView, WM_CANCELMODE, 0, 0);

				dpp->fUndockNextMsg = TRUE;
				DragOff(dpp);
			}
			else
			{
				// otherwise detach the tab and float it in a new DOCKPANEL
				UndockAndRemoveTab(dpp, (UINT)tci.lParam);
			}
			break;
		}

		return 0;
	}
	else
	{
		// forward it straight on
		return SendMessage(dpp->hwndMain, WM_NOTIFY, wParam, (LPARAM)hdr);
	}
}
Exemplo n.º 5
0
void TabBar::removeTab(const int index)
{
  if(currentIndex() == index)
    setCurrentIndex(index == 0 ? index + 1 : index - 1);

  if(TabCtrl_DeleteItem(handle(), index))
    m_pages.erase(m_pages.begin() + index);
}
Exemplo n.º 6
0
void TabBar::clear()
{
  m_pages.clear();

#ifdef TabCtrl_DeleteAllItems
  TabCtrl_DeleteAllItems(handle());
#else
  for(int i = count(); i > 0; i--)
    TabCtrl_DeleteItem(handle(), i - 1);
#endif
}
Exemplo n.º 7
0
// remove one page from the notebook, without deleting
wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
{
    wxNotebookPage *pageRemoved = wxNotebookBase::DoRemovePage(nPage);
    if ( !pageRemoved )
        return NULL;

    // hide the removed page to maintain the invariant that only the
    // selected page is visible and others are hidden:
    pageRemoved->Show(false);

    TabCtrl_DeleteItem(GetHwnd(), nPage);

    if ( m_pages.IsEmpty() )
    {
        // no selection any more, the notebook becamse empty
        m_selection = wxNOT_FOUND;
    }
    else // notebook still not empty
    {
        int selNew = TabCtrl_GetCurSel(GetHwnd());
        if ( selNew != wxNOT_FOUND )
        {
            // No selection change, just refresh the current selection.
            // Because it could be that the slection index changed
            // we need to update it.
            // Note: this does not mean the selection it self changed.
            m_selection = selNew;
            m_pages[m_selection]->Refresh();
        }
        else if (int(nPage) == m_selection)
        {
            // The selection was deleted.

            // Determine new selection.
            if (m_selection == int(GetPageCount()))
                selNew = m_selection - 1;
            else
                selNew = m_selection;

            // m_selection must be always valid so reset it before calling
            // SetSelection()
            m_selection = wxNOT_FOUND;
            SetSelection(selNew);
        }
        else
        {
            wxFAIL; // Windows did not behave ok.
        }
    }

    return pageRemoved;
}
Exemplo n.º 8
0
static void RemoveTab(WindowInfo* win, int idx) {
    TabInfo* tab = win->tabs.at(idx);
    UpdateTabFileDisplayStateForWin(win, tab);
    win->tabSelectionHistory->Remove(tab);
    win->tabs.Remove(tab);
    if (tab == win->currentTab) {
        win->ctrl = nullptr;
        win->currentTab = nullptr;
    }
    delete tab;
    TabCtrl_DeleteItem(win->hwndTabBar, idx);
    UpdateTabWidth(win);
}
Exemplo n.º 9
0
// 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?

        SaveCurrentTabData(win);
        return FALSE;

    case TCN_SELCHANGE:
        {
            int current = TabCtrl_GetCurSel(win->hwndTabBar);
            LoadModelIntoTab(win, GetTabData(win, current));
            UpdateCurrentTabBgColForWindow(win);
        }
        break;

    case T_CLOSING:
        // allow the closure
        return FALSE;

    case T_CLOSE:
        {
            int current = TabCtrl_GetCurSel(win->hwndTabBar);
            if (tab1 == current) {
                CloseTab(win);
            }
            else {
                TabData *tdata = GetTabData(win, tab1);
                win->tabSelectionHistory->Remove(tdata);
                UpdateTabFileDisplayStateForWin(win, tdata);
                DeleteTabData(tdata, true);
                TabCtrl_DeleteItem(win->hwndTabBar, tab1);
                UpdateTabWidth(win);
            }
        }
        break;

    case T_DRAG:
        SwapTabs(win, tab1, tab2);
        break;
    }
    return TRUE;
}
Exemplo n.º 10
0
void TabControl::SetShowTabTitles(bool enabled)
{
	showTabTitles = enabled;
	int itemCount = TabCtrl_GetItemCount(hwnd);

	for (int i = 0; i < itemCount; i++)
	{
		TabCtrl_DeleteItem(hwnd,0);
	}

	if (showTabTitles)
	{
		for (int i = 0; i < (int) tabs.size(); i++)
		{
			AppendPageToControl(tabs[i].title);
			
			if (hasButtons == false && !noDisplayArea_)
			{
				DWORD style = GetWindowLong(tabs[i].pageHandle,GWL_STYLE) & (~WS_BORDER);
				SetWindowLong(tabs[i].pageHandle,GWL_STYLE,style);

				DWORD exStyle = GetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE) & (~WS_EX_CLIENTEDGE);
				SetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE,exStyle);
			}
		}
		TabCtrl_SetCurSel(hwnd,CurrentTabIndex());
	} else if (hasButtons == false && !noDisplayArea_)
	{
		for (int i = 0; i < (int) tabs.size(); i++)
		{
			if (tabs[i].hasBorder)
			{
				DWORD style = GetWindowLong(tabs[i].pageHandle,GWL_STYLE) | WS_BORDER;
				SetWindowLong(tabs[i].pageHandle,GWL_STYLE,style);
			}

			if (tabs[i].hasClientEdge)
			{
				DWORD exStyle = GetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE) | WS_EX_CLIENTEDGE;
				SetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE,exStyle);
			}
		}
	}
	
	OnResize();
}
Exemplo n.º 11
0
bool RemoveTab(HWND TabWindow, int Index)
{
	assert(IsWindow(TabWindow));
	assert(Index >= 0);
	assert(Index < TabCtrl_GetItemCount(TabWindow));

	TC_ITEM TabData;
	TabData.mask = TCIF_IMAGE | TCIF_PARAM;

	if(TabCtrl_GetItem(TabWindow, Index, &TabData))
	{
		int CurIndex = TabCtrl_GetCurSel(TabWindow);
		assert(CurIndex >= -1);
		if(CurIndex != -1 && TabCtrl_DeleteItem(TabWindow, Index))
		{
			if(TabData.iImage != -1)
				TabCtrl_RemoveImage(TabWindow, TabData.iImage);

			int Count = TabCtrl_GetItemCount(TabWindow);
			assert(Count >= 0);
			if(Count == 0) // We just removed the last one, do some addition cleanup
			{
				ShowWindow(reinterpret_cast<HWND>(TabData.lParam), SW_HIDE);
				HIMAGELIST ImageList = TabCtrl_GetImageList(TabWindow);
				if(ImageList)
				{
					ImageList_Destroy(ImageList);
					TabCtrl_SetImageList(TabWindow, NULL);
				}
				RemoveProp(TabWindow, PropName);
			}
			else if(Index == CurIndex) // We're deleting the currently visible tab
			{
				if(Index == Count) // Last tab
					Index--;
				TabToFront(TabWindow, Index);
			}

			SetTabThemeTexture(reinterpret_cast<HWND>(TabData.lParam), false);
			return true;
		}
	}
	return false;
}
Exemplo n.º 12
0
BOOL HexCloseFile(MAINWND *mainWnd, int iItem)
{
	TCITEM	tci = { TCIF_PARAM };
	HWND	hwndHV;
	TCHAR	szFilePath[MAX_PATH];

	if(!TabCtrl_GetItem(mainWnd->hwndTabView, iItem, &tci))
		return FALSE;

	hwndHV = (HWND)tci.lParam;

	// is this the last tab left?
	if(TabCtrl_GetItemCount(mainWnd->hwndTabView) == 1)
	{
		HexView_Clear((HWND)tci.lParam);
		
		tci.mask = TCIF_TEXT;
		tci.pszText = TEXT("(Untitled)");
		TabCtrl_SetItem(mainWnd->hwndTabView, 0, &tci);
		tci.lParam = 0;
	}
	else
	{
		// remove the tab
		TabCtrl_DeleteItem(mainWnd->hwndTabView, iItem);
	}

	// set focus to a new tab
	iItem = TabCtrl_GetCurSel(mainWnd->hwndTabView);
	HexSetCurFile(mainWnd->hwndMain, iItem, TRUE);
	
	// lastly destroy the unwanted hexview
	SaveHighlights(hwndHV);
	
	HexView_GetFileName(hwndHV, szFilePath, MAX_PATH);
	
	if(hwndHV == (HWND)tci.lParam)
		DestroyWindow(hwndHV);

	UpdateHighlight(szFilePath, 0, TRUE);
	return TRUE;
}
Exemplo n.º 13
0
BOOL DockWnd_HideInternal2(DOCKWND *dwp, BOOL fPreserveContent)
{
	DOCKPANEL *dpp = dwp->pDockPanel;
	int idx;

	dwp->fVisible = FALSE;

	if(fPreserveContent == FALSE)
	{
		// destroy the content
		DestroyWindow(dwp->hwndContents);
		dwp->hwndContents = 0;
	}

	// remove the tab
	idx = TabCtrl_GetCurSel(dpp->hwndTabView);
	TabCtrl_DeleteItem(dpp->hwndTabView, idx);
	UpdateDockTabView(dpp);

	// destroy the DOCKPANEL if this is the last tab
	if(dpp->hwndTabView && TabCtrl_GetItemCount(dpp->hwndTabView) == 0 || !dpp->hwndTabView)
	{
		DestroyWindow(dpp->hwndPanel);
		dpp->fVisible = FALSE;
	}
	// show the next item
	else
	{
		TCITEM tci = { TCIF_PARAM };
		DOCKWND *dwpnext;
				
		idx = TabCtrl_GetCurSel(dpp->hwndTabView);
		TabCtrl_GetItem(dpp->hwndTabView, idx, &tci);

		dpp->uCurrentTabId = (UINT)tci.lParam;
		dwpnext = DOCKWNDFromId(dpp->hwndMain, (UINT)tci.lParam);

		DockWnd_ShowInternal2(dwpnext);//, TRUE, fRemoving);
	}

	return TRUE;
}
Exemplo n.º 14
0
View* NativeTabbedPaneWin::RemoveTabAtIndex(int index)
{
    int tab_count = static_cast<int>(tab_views_.size());
    DCHECK(index >= 0 && index < tab_count);

    if(index < (tab_count - 1))
    {
        // Select the next tab.
        SelectTabAt(index + 1);
    }
    else
    {
        // We are the last tab, select the previous one.
        if(index > 0)
        {
            SelectTabAt(index - 1);
        }
        else if(content_window_)
        {
            // That was the last tab. Remove the contents.
            content_window_->GetRootView()->RemoveAllChildViews(false);
        }
    }
    TabCtrl_DeleteItem(native_view(), index);

    // The removed tab may have made the contents window bigger.
    if(content_window_)
    {
        ResizeContents();
    }

    std::vector<View*>::iterator iter = tab_views_.begin() + index;
    View* removed_tab = *iter;
    if(content_window_)
    {
        content_window_->GetRootView()->RemoveChildView(removed_tab);
    }
    tab_views_.erase(iter);
    tab_titles_.erase(tab_titles_.begin() + index);

    return removed_tab;
}
Exemplo n.º 15
0
void ChatContainer::removeChild(ChatWindow *child) {
	HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
	int iSel = getChildTab(child);
	if (iSel >= 0) {
		TabCtrl_DeleteItem(hwndTabs, iSel);
	}
	childCount--;
	if (childCount > 0) {
		TCITEM tci;
		if (iSel == childCount) iSel--;
		TabCtrl_SetCurSel(hwndTabs, iSel);
		tci.mask = TCIF_PARAM;
		if (TabCtrl_GetItem(hwndTabs, iSel, &tci)) {
			child = (ChatWindow *)tci.lParam;
			activateChild(child);
		}
	} else {//if (!released) {
		SendMessage(hWnd, WM_CLOSE, 0, 0);
	}
}
Exemplo n.º 16
0
static void RemoveChild(struct ParentWindowData *dat, HWND child)
{
	int i;
	for (i=0;i<dat->childrenCount;i++) {
		if (dat->children[i] == child) {
			MoveMemory(&dat->children[i], &dat->children[i+1], sizeof(HWND)*(dat->childrenCount-i-1));
			dat->childrenCount--;
			break;
		}
	}
	i = GetTabFromHWND(dat, child);
	if (i >= 0) {
		TabCtrl_DeleteItem(dat->hwndTabs, i);
	}
	if (dat->childrenCount > 0) {
		if (i == TabCtrl_GetItemCount(dat->hwndTabs)) i--;
		if (i >=0 ) {
			ActivateChild(dat, GetChildFromTab(dat->hwndTabs, i)->hwnd);
		}
	}
}
Exemplo n.º 17
0
void Notebook::closePage(int n) {
	if(n<0 || n>=(int)pages.size()) n = selected;
	if(pages.size()>0) {
debug_output("Notebook::closePage(n: %d, pages: %d)\n",n,(int)pages.size());
		int i;
		NotebookPage *np = (NotebookPage *)pages[n];
		if(n==selected) selectPage(n==0? n+1 : n-1);
#ifdef USE_GTK
		gtk_notebook_remove_page(GTK_NOTEBOOK(component),n);
#endif
#ifdef USE_WIN32
		if(type==WIDGET_NOTEBOOK) TabCtrl_DeleteItem((HWND)component,n);
#endif
		pages.removeAt(n);
		delete np;

		for(i=pages.size()-1; i>=n; --i) {
			np = (NotebookPage *)pages[i];
debug_output("Notebook::closePage(index=%d -> i=%d)\n",np->tab.index,i);
			np->tab.index = i;
		}
	}
}
Exemplo n.º 18
0
// Called when we're closing a document
void TabsOnCloseDoc(WindowInfo *win)
{
    int count = TabsGetCount(win);
    if (count <= 0)
        return;

    if (win->AsFixed() && win->AsFixed()->userAnnots && win->AsFixed()->userAnnotsModified) {
        // TODO: warn about unsaved changes
    }

    int current = TabCtrl_GetCurSel(win->hwndTabBar);
    TabData *tdata = GetTabData(win, current);
    win->tabSelectionHistory->Remove(tdata);
    UpdateTabFileDisplayStateForWin(win, tdata);
    DeleteTabData(tdata, false);
    TabCtrl_DeleteItem(win->hwndTabBar, current);
    UpdateTabWidth(win);
    if (count > 1) {
        tdata = win->tabSelectionHistory->Pop();
        TabCtrl_SetCurSel(win->hwndTabBar, FindTabIndex(win, tdata));
        LoadModelIntoTab(win, tdata);
        UpdateCurrentTabBgColForWindow(win);
    }
}
Exemplo n.º 19
0
// Delete an item
bool wxTabCtrl::DeleteItem(int item)
{
    return ( TabCtrl_DeleteItem( (HWND) GetHWND(), item) != FALSE );
}
Exemplo n.º 20
0
void WindowBar_Update(LPFILEVIEW lpFileView, UINT nAction)
{
    int cItems, i;

    if (nAction == WM_CREATE)
    {
        tci.mask = TCIF_TEXT | TCIF_PARAM;
        tci.pszText = Path_GetFileName(lpFileView->pszFileName);
        tci.lParam = (LPARAM)lpFileView->hwndView;
        TabCtrl_SetCurSel(g_hwndTabWindowBar,
                    TabCtrl_InsertItem(g_hwndTabWindowBar,
                            TabCtrl_GetItemCount(g_hwndTabWindowBar), &tci));

        return;
    }

    cItems = TabCtrl_GetItemCount(g_hwndTabWindowBar);

    for (i = 0; i < iItems; i++)
    {
        TCITEM tci;

        tci.mask    = TCIF_PARAM;
        tci.lParam  = 0;

        TabCtrl_GetItem(g_hwndTabWindowBar, i, &tci);

        if ((HWND)tci.lParam == lpFileView->hwndView)
        {
            switch (nAction)
            {
                case WM_CLOSE:
                {
                    TabCtrl_DeleteItem(g_hwndTabWindowBar, i);
                    MDI_Next(g_hwndMDIClient, lpFileView->hwndView, FALSE);
                }
                break;
                case WM_ACTIVATE:
                {
                    if (!IsIconic(lpFileView->hwndView))
                        TabCtrl_SetCurSel(g_hwndTabWindowBar, cnt);
                }
                break;
                case SIZE_MINIMIZED:
                {
                    ShowWindow(lpFileView->hwndView, SW_HIDE);
                    TabCtrl_DeselectAll(g_hwndTabWindowBar, FALSE);
                    MDI_Next(g_hwndMDIClient, lpFileView->hwndView, FALSE);
                }
                break;
                case SIZE_RESTORED:
                {
                    if (IsIconic(lpFileView->hwndView))
                    {
                        ShowWindow(lpFileView->hwndView, SW_RESTORE);
                        ShowWindow(lpFileView->hwndView, SW_SHOW);
                    }
                }
                break;
                case TCM_SETTEXT:
                {
                    tci.mask = TCIF_TEXT | TCIF_PARAM;
                    tci.pszText = lpFileView->pszFileName;
                    tci.lParam = (LPARAM)lpFileView->hwndView;
                    TabCtrl_SetItem(g_hwndTabWindowBar, i, &tci);
                }
                break;
            }
        }
    }
}
Exemplo n.º 21
0
//
//	Main Window message handler
//
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    NMHDR *hdr;
    POINT pt;
    RECT  rect;
    HMENU hMenu;
    HWND hwndHV = GetActiveHexView(hwnd);//g_hwndHexView;
    int i;
    TCITEM tci;

    MAINWND *mainWnd = (MAINWND *)GetWindowLongPtr(hwnd, 0);

    switch(msg)
    {
    case WM_NCCREATE:

        if((mainWnd = malloc(sizeof(MAINWND))) == 0)
            return FALSE;

        SetWindowLongPtr(hwnd, 0, (LONG_PTR)mainWnd);
        ZeroMemory(mainWnd, sizeof(MAINWND));
        return TRUE;

    case WM_NCDESTROY:
        free(mainWnd);
        return 0;

    case WM_CREATE:

        g_hwndMain = hwnd;

        SetWindowIcon(hwnd, IDI_APP);

        // create a child-window EDIT control
        //g_hwndHexView	= CreateHexViewCtrl(hwnd);
        g_hwndTabView	= CreateWindow(WC_TABVIEW, TEXT(""), WS_CHILD|WS_VISIBLE,0,0,0,0,hwnd, 0, g_hInstance, 0);
        g_hwndStatusBar = CreateStatusBar(hwnd);

        SendMessage(g_hwndTabView, TCM_SETITEMSIZE, 0, MAKELPARAM(150, 0));

        SetStatusBarParts(g_hwndStatusBar);

        hwndHV = g_hwndHexView;

        mainWnd->hwndMain		= hwnd;
        mainWnd->hwndStatusBar	= g_hwndStatusBar;
        mainWnd->hwndTabView	= g_hwndTabView;

        CreateToolTip(g_hwndHexView);

//		g_hwndDock[0] = CreateDockWnd(&dock, hwnd, TEXT("Toolbar"));



        //g_hwndToolbar   = InitToolbar(hwnd);
        //g_hwndSearchBar = CreateSearchBar(hwnd);
        //g_hwndTypeView  = CreateTypeView(hwnd);


        SetFocus(hwndHV);


        // tell windows that we can handle drag+drop'd files
        DragAcceptFiles(hwnd, TRUE);

        UpdateRecentMenu(GetSubMenu(GetMenu(hwnd), 0));

        SetTimer(hwnd, 0xdeadbeef, 1000, 0);

        return TRUE;

    case WM_TIMER:
        if(wParam == 0xdeadbeef)
        {
            KillTimer(hwnd, wParam);
            //FirstTimeOptions(hwnd);
        }
        return 0;

    case WM_DROPFILES:

        // get the screen coordinates of the drop-location
        if(DragQueryPoint((HDROP)wParam, &pt))
            ClientToScreen(hwnd, &pt);

        GetWindowRect(hwndHV, &rect);

        // drop anywhere *except* the hexview, as that does D&D itself
        if(!PtInRect(&rect, pt))
        {
            HandleDropFiles(hwnd, (HDROP)wParam);
        }

        //CreateToolTip(mainWnd->hwndTabView);
        return 0;

    case WM_ENABLE:
        EnableWindow(g_hwndSearch, (BOOL)wParam);
        EnableWindow(g_hwndGoto, (BOOL)wParam);
        return 0;

    case WM_CONTEXTMENU:
        if((HWND)wParam == DockWnd_GetWindow(hwnd, DWID_TYPEVIEW))
        {
            HMENU hMenu = GetSubMenu(LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_TYPECONTEXT)), 0);
            UINT  u;

            MenuCheckMark(hMenu, IDM_TYPEVIEW_HEX, g_fDisplayHex);
            MenuCheckMark(hMenu, IDM_TYPEVIEW_BIGENDIAN, g_fDisplayBigEndian);
            u = TrackPopupMenu(hMenu, TPM_RETURNCMD, (short)LOWORD(lParam), (short)HIWORD(lParam), 0, hwnd, 0);

            SendMessage(DockWnd_GetContents(hwnd, DWID_TYPEVIEW), WM_COMMAND, u, 0);
        }

        break;

    case WM_COMMAND:
        return HexEdit_OnCommand(hwnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam);

    case WM_NOTIFY:
        hdr = (NMHDR *)lParam;
        if(hdr->hwndFrom == hwndHV)
            return HexViewNotifyHandler(mainWnd, hwnd, hdr);
        else
            return HexEdit_OnNotify(mainWnd, hwnd, (UINT)wParam, (NMHDR *)lParam);

    case WM_CLOSE:

        tci.mask = TCIF_PARAM;

        for(i = 0; (hwndHV = EnumHexView(hwnd, i)) != NULL; )
        {
            UINT uAnswer = HexFileCloseNotify(hwnd, hwndHV);

            if(uAnswer == IDCANCEL)
            {
                return 0;
            }
            else if(uAnswer == IDNO)
            {
                SaveHighlights(hwndHV);
                TabCtrl_DeleteItem(mainWnd->hwndTabView, i);
            }
            else
            {
                i++;
            }
        }

        // save settings *before* we destroy anything!
        DockWnd_SaveSettings(hwnd);

        // shut program down
        DestroyWindow(hwnd);
        return 0;

    case WM_DESTROY:
        DestroyWindow(hwndHV);

        //
        PostQuitMessage(0);
        return 0;

    case WM_SETFOCUS:
        SetFocus(hwndHV);
        return 0;

    case WM_SIZE:

        MainWndSize(mainWnd, LOWORD(lParam), HIWORD(lParam));
        UpdateStatusbar(mainWnd->hwndStatusBar);

        return 0;

    case WM_INITMENUPOPUP:
        hMenu = (HMENU)wParam;//GetMenu(hwnd);

        MenuCheckMark(hMenu, IDM_VIEW_TOOLBAR, DockWnd_IsOpen(hwnd, DWID_TOOLBAR));
        MenuCheckMark(hMenu, IDM_TOOLS_TYPEVIEW, DockWnd_IsOpen(hwnd, DWID_TYPEVIEW));
        MenuCheckMark(hMenu, IDM_TOOLS_SEARCHBAR, DockWnd_IsOpen(hwnd, DWID_SEARCHBAR));

        CheckMenuRadioItem(hMenu, IDM_VIEW_HEX, IDM_VIEW_BIN,
                           IDM_VIEW_HEX + (HexView_GetStyle(hwndHV) & HVS_FORMAT_MASK),
                           MF_BYCOMMAND);

        {   int look[32] = { 0, 0, 1, 0, 2 };
            CheckMenuRadioItem(hMenu, IDM_GROUP_BYTE, IDM_GROUP_DWORD,
                               IDM_GROUP_BYTE + look[HexView_GetGrouping(hwndHV)],
                               MF_BYCOMMAND);
        }

        {
            size_w selsize;
            UINT   edmode  = HexView_GetEditMode(hwndHV);
            BOOL   cftext  = IsClipboardFormatAvailable(CF_TEXT);
            BOOL   canundo = HexView_CanUndo(hwndHV);
            BOOL   canredo = HexView_CanRedo(hwndHV);

            HexView_GetSelSize(hwndHV, &selsize);

            //hMenu = GetSubMenu(GetMenu(hwnd), 1);

            EnableMenuCmdItem(hMenu, IDM_EDIT_UNDO,  canundo);
            EnableMenuCmdItem(hMenu, IDM_EDIT_REDO,  canredo);
            EnableMenuCmdItem(hMenu, IDM_EDIT_CUT,  selsize > 0 && edmode == HVMODE_INSERT);
            EnableMenuCmdItem(hMenu, IDM_EDIT_COPY, selsize > 0);
            EnableMenuCmdItem(hMenu, IDM_EDIT_COPYAS, selsize > 0);
            EnableMenuCmdItem(hMenu, IDM_EDIT_PASTE, cftext && edmode != HVMODE_READONLY  );
            EnableMenuCmdItem(hMenu, IDM_EDIT_PASTESPECIAL, edmode != HVMODE_READONLY  );
            EnableMenuCmdItem(hMenu, IDM_EDIT_DELETE, selsize > 0 && edmode != HVMODE_READONLY );

            EnableMenuCmdItem(hMenu, IDM_EDIT_REVERSE, selsize > 0 && edmode != HVMODE_READONLY );
            EnableMenuCmdItem(hMenu, IDM_TOOLS_TRANSFORM, selsize > 0 && edmode != HVMODE_READONLY );

            EnableMenuCmdItem(hMenu, IDM_FILE_REVERT, canundo || canredo);
        }

        return 0;
    }

    return DefWindowProc(hwnd, msg, wParam, lParam);
}
Exemplo n.º 22
0
void
mxTab::remove (int index)
{
	TabCtrl_DeleteItem ((HWND) getHandle (), index);
}
Exemplo n.º 23
0
BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	struct TabCtrlData *dat;
	dat = (struct TabCtrlData *) GetWindowLong(hwnd, GWL_USERDATA);
    switch(msg) {
        case WM_MBUTTONDOWN:
		{
			TCITEM tci;
			int tabId;
			struct MessageWindowData *mwd;
			TCHITTESTINFO thinfo;
			thinfo.pt.x = (lParam<<16)>>16;
			thinfo.pt.y = lParam>>16;
			tabId = TabCtrl_HitTest(hwnd, &thinfo);
			if (tabId >= 0) {
				tci.mask = TCIF_PARAM;
				TabCtrl_GetItem(hwnd, tabId, &tci);
				mwd = (struct MessageWindowData *) tci.lParam;
				if (mwd != NULL) {
					SendMessage(mwd->hwnd, WM_CLOSE, 0, 0);
    			}
			}
	        return TRUE;
        }
		case WM_LBUTTONDBLCLK:
		{
			TCHITTESTINFO thinfo;
			int tabId;
			thinfo.pt.x = (lParam<<16)>>16;
			thinfo.pt.y = lParam>>16;
			tabId = TabCtrl_HitTest(hwnd, &thinfo);
			if (tabId >=0 ) {
				void * clickChild = GetChildFromTab(hwnd, tabId)->hwnd;
				if (clickChild == dat->lastClickChild) {
					SendMessage(clickChild, WM_CLOSE, 0, 0);
				}
			}
			dat->lastClickChild = NULL;
		}
		break;
		case WM_LBUTTONDOWN:
		{
			if (!dat->bDragging) {
				FILETIME ft;
				TCHITTESTINFO thinfo;
				GetSystemTimeAsFileTime(&ft);
				thinfo.pt.x = (lParam<<16)>>16;
				thinfo.pt.y = lParam>>16;
				dat->srcTab = dat->destTab = TabCtrl_HitTest(hwnd, &thinfo);
				if (dat->srcTab >=0 ) {
					dat->lastClickChild = GetChildFromTab(hwnd, dat->srcTab)->hwnd;
				} else {
					dat->lastClickChild = NULL;
				}
				dat->bDragging = TRUE;
				dat->bDragged = FALSE;
				dat->clickLParam = lParam;
				dat->clickWParam = wParam;
				dat->lastClickTime = ft.dwLowDateTime;
				dat->mouseLBDownPos.x = thinfo.pt.x;
				dat->mouseLBDownPos.y = thinfo.pt.y;
				SetCapture(hwnd);
				return 0;
			}
		}
		break;
		case WM_CAPTURECHANGED:
		case WM_LBUTTONUP:
			if (dat->bDragging) {
				TCHITTESTINFO thinfo;
				thinfo.pt.x = (lParam<<16)>>16;
				thinfo.pt.y = lParam>>16;
				if (dat->bDragged) {
					ImageList_DragLeave(GetDesktopWindow());
					ImageList_EndDrag();
					ImageList_Destroy(dat->hDragImageList);
					SetCursor(LoadCursor(NULL, IDC_ARROW));
					dat->destTab = TabCtrl_HitTest(hwnd, &thinfo);
					if (thinfo.flags != TCHT_NOWHERE && dat->destTab != dat->srcTab)  {
						NMHDR nmh;
						TCHAR  sBuffer[501];
						TCITEM item;
						int curSel;
						curSel = TabCtrl_GetCurSel(hwnd);
						item.mask = TCIF_IMAGE | TCIF_PARAM | TCIF_TEXT;
						item.pszText = sBuffer;
						item.cchTextMax = sizeof(sBuffer)/sizeof(TCHAR);
						TabCtrl_GetItem(hwnd, dat->srcTab, &item);
						sBuffer[sizeof(sBuffer)/sizeof(TCHAR)-1] = '\0';
						if (curSel == dat->srcTab) {
							curSel = dat->destTab;
						} else {
							if (curSel > dat->srcTab && curSel <= dat->destTab) {
								curSel--;
							} else if (curSel < dat->srcTab && curSel >= dat->destTab) {
								curSel++;
							}
						}
						TabCtrl_DeleteItem(hwnd, dat->srcTab);
						TabCtrl_InsertItem(hwnd, dat->destTab, &item );
						TabCtrl_SetCurSel(hwnd, curSel);
						nmh.hwndFrom = hwnd;
						nmh.idFrom = GetDlgCtrlID(hwnd);
						nmh.code = TCN_SELCHANGE;
						SendMessage(GetParent(hwnd), WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh);
						UpdateWindow(hwnd);
					}
				} else {
					SendMessage(hwnd, WM_LBUTTONDOWN, dat->clickWParam, dat->clickLParam);
				}
				dat->bDragged = FALSE;
				dat->bDragging = FALSE;
				ReleaseCapture();
			}
Exemplo n.º 24
0
void CTabPanelWin::DeleteItemInt(int I)
{
	if (!mh_Tabbar) return;

	TabCtrl_DeleteItem(mh_Tabbar, I);
}
Exemplo n.º 25
0
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
	case WM_INITDIALOG:
		{
			HWND hTabControl = GetDlgItem(hwndDlg, IDC_TAB1);

			TCITEM tci;
			tci.mask = TCIF_TEXT | TCIF_IMAGE;
			tci.iImage = -1;

			tci.pszText = tab_label[0];
			TabCtrl_InsertItem(hTabControl, 0, &tci);

			tci.pszText = tab_label[1];
			TabCtrl_InsertItem(hTabControl, 1, &tci);

			//if(dcPlatform != 2 && (!isPSemulator || multitap > 0))
			if (!isPSemulator || multitap > 0)
			{
				tci.pszText = tab_label[2];
				TabCtrl_InsertItem(hTabControl, 2, &tci);

				tci.pszText = tab_label[3];
				TabCtrl_InsertItem(hTabControl, 3, &tci);
			}

			hChild = CreateDialog((HINSTANCE)lParam, MAKEINTRESOURCE(IDD_INTAB), hwndDlg, DialogProc2);
			EnableThemeDialogTexture(hChild, ETDT_ENABLETAB);

			EnableWindow(GetDlgItem(hwndDlg, IDC_MULTITAP), isPSemulator);
			EnableWindow(GetDlgItem(hwndDlg, IDC_SWAPPORTS), isPSemulator);
			
			CheckDlgButton(hwndDlg, IDC_SWAPPORTS, SwapPortsEnabled ? BST_CHECKED : BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_PROCPRIORITY, bPriority ? BST_CHECKED : BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_SCREENSAVER, bKeepAwake ? BST_CHECKED : BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_MULTITAP, multitap % 4);

			ShowWindow(hwndDlg, SW_SHOW);
		} break;

	case WM_COMMAND:
		{
			s16 command = LOWORD(wParam);

			switch(command)
			{
			case IDC_PROCPRIORITY:
				bPriority = IsDlgButtonChecked(hwndDlg, IDC_PROCPRIORITY) == BST_CHECKED;
				break;

			case IDC_SWAPPORTS:
				SwapPortsEnabled = IsDlgButtonChecked(hwndDlg, IDC_SWAPPORTS) == BST_CHECKED;
				break;



			case IDC_SCREENSAVER:
				bKeepAwake = IsDlgButtonChecked(hwndDlg, IDC_SCREENSAVER) == BST_CHECKED;
				break;

			case IDC_MULTITAP:
				{
					multitap = IsDlgButtonChecked(hwndDlg, IDC_MULTITAP) & 0xFF;
					HWND hTabControl = GetDlgItem(hwndDlg, IDC_TAB1);
					u8 tabs = (u8)TabCtrl_GetItemCount(hTabControl);

					if(multitap > 0)
					{
						if(tabs < 3)
						{
							TCITEM tci;
							tci.mask = TCIF_TEXT | TCIF_IMAGE;
							tci.iImage = -1;

							tci.pszText = tab_label[2];
							TabCtrl_InsertItem(hTabControl, 2, &tci);

							tci.pszText = tab_label[3];
							TabCtrl_InsertItem(hTabControl, 3, &tci);
						}
					}
					else
					{
						TabCtrl_SetCurSel(hTabControl, 0);

						TabCtrl_DeleteItem(hTabControl, 3);
						TabCtrl_DeleteItem(hTabControl, 2);
					}

					RedrawWindow(hChild, NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
				}
				break;

			case IDRESET:
				{
					s32 port =  TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB1));
					settings[port].SetDefaults();
					SendMessage(hChild, WM_USER, 0xDEADBEEF, port);
				}
				break;

			case ID_OK:
					FileIO::INI_SaveSettings(); // SAVE SETTINGS
			case ID_CANCEL:
					EndDialog(hwndDlg, command); // .. and QUIT
					PostQuitMessage(0);
					break;
			}

		} break;

	case WM_NOTIFY:
			if ( ((LPNMHDR)lParam)->idFrom==IDC_TAB1 && ((LPNMHDR)lParam)->code == TCN_SELCHANGE  )
			{
				s32 port =  TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB1));
				SendMessage(hChild, WM_USER, 0xDEADBEEF, port);
			}
			break;

	default: return FALSE;
	}

	return TRUE;
}
Exemplo n.º 26
0
static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	switch(message) {
	case WM_INITDIALOG:
	{
		TCHAR title[MAX_PATH];
		TCHAR name[MAX_PATH] = {0};
		TCHAR path[MAX_PATH] = {0};

		hTabs = GetDlgItem(hwndDlg, IDC_TABS);

		//TabCtrl_SetMinTabWidth(hTabs, 100);

		// restore position
		Utils_RestoreWindowPositionEx(hwndDlg,RWPF_HIDDEN,NULL,"Console","Console");

		CallService(MS_DB_GETPROFILENAMET,(WPARAM)SIZEOF(name),(LPARAM)name);

		CallService(MS_DB_GETPROFILEPATHT,(WPARAM)SIZEOF(path),(LPARAM)path);

		mir_sntprintf(title, SIZEOF(title), _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name);

		SetWindowText(hwndDlg, title);
		SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)hIcons[0]);

		hwndConsole = hwndDlg;
		SendMessage(hwndDlg, HM_ADD, 0, 0);
		PostMessage(hwndDlg, WM_SIZE, 0, 0);
		break;
	}
	case HM_DUMP:
	{
		// lParam = DUMPMSG
		int idx;
		LOGWIN *lw;
		LOGWIN lw2;
		DUMPMSG *dumpMsg = (DUMPMSG*)lParam;

		if (!pActive) {
			mir_free(dumpMsg);
			break;
		}

		if (!gSingleMode)
		{
			lw2.Module = dumpMsg->szModule;
			if (!List_GetIndex(&lModules, &lw2, &idx))
				SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule);

			lw = (LOGWIN*)lModules.items[idx];
		}
		else
			lw = pActive;

		if (lw->hwnd)
			SendMessage(lw->hwnd, HM_DUMP, wParam, lParam);
		else
			PostMessage(hwndDlg, HM_DUMP, wParam, lParam); // loop msg until window will be ready

		return TRUE;
	}
	case HM_ADD:
	{
		// wParam = index, lParam = module name
		LOGWIN *lw;
		COLORREF col;
		TCITEM tci = {0};
		int idx = (int)wParam;
		char *str = (char*)lParam;

		if (!str) str = ""; // startup window

		lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN));
		lw->Module = (char*)mir_strdup(str);
		List_Insert(&lModules, lw, idx);

		if (!gSingleMode && lParam)
		{
			tci.mask = TCIF_PARAM | TCIF_TEXT;
			tci.lParam = (LPARAM)lw;

			tci.pszText = mir_a2u(lw->Module);
			idx = TabCtrl_InsertItem(hTabs, tabCount, &tci);
			mir_free(tci.pszText);

			tabCount++;
		}

		GetClientRect(hTabs, &rcTabs);
		TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs);

		CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LOG), hwndDlg, LogDlgProc, (LPARAM)lw);
		ShowWindow(lw->hwnd, (tabCount > 1)?SW_HIDE:SW_SHOWNOACTIVATE);

		if (pActive)
		{
			col = ListView_GetBkColor(pActive->hList);
			ListView_SetBkColor(lw->hList, col);
			ListView_SetTextBkColor(lw->hList, col);

			col = ListView_GetTextColor(pActive->hList);
			ListView_SetTextColor(lw->hList, col);

			if (hfLogFont)
				SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, TRUE);
		}

		// hide startup window
		if (tabCount == 1)
		{
			ShowWindow(pActive->hwnd, SW_HIDE);
			PostMessage(pActive->hwnd, WM_CLOSE, 0, 0);
			pActive = lw;
		}

		if (!pActive)
			pActive = lw;

		return TRUE;
	}
	case HM_REMOVE:
	{
		// lParam = LOGWIN
		LOGWIN *lw = (LOGWIN*)lParam;

		if (!lw) break;

		if (lw == pActive)
		{
			int tab = TabCtrl_GetCurSel(hTabs);
			if (tab >= 0)
			{
				TCITEM tci={0};

				TabCtrl_DeleteItem(hTabs, tab);
				tabCount--;
				if (tabCount)
				{
					tab--;
					if (tab < 0 ) tab = 0;
					TabCtrl_SetCurSel(hTabs, tab);

					tci.mask = TCIF_PARAM;
					TabCtrl_GetItem(hTabs, tab, &tci);
					pActive = (LOGWIN*)tci.lParam;
					SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
					ScrollDown(pActive);
					ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE);
					SetFocus(pActive->hList);
				}
				else
					pActive = NULL;
			}
		}

		List_RemovePtr(&lModules, lw);
		mir_free(lw->Module);
		mir_free(lw);
		return TRUE;
	}
	case HM_SETFONT:
	{
		// wParam = font, lParam = font color
		int i;
		LOGWIN *lw;
		for ( i = 0; i < lModules.realCount; i++ )
		{
			lw = (LOGWIN*)lModules.items[i];
			ListView_SetTextColor(lw->hList, (COLORREF)lParam);
			if (wParam)
				SendMessage(lw->hList, WM_SETFONT, wParam, TRUE);
		}
		return TRUE;
	}
	case HM_SETCOLOR:
	{
		// wParam = font, lParam = background color
		int i;
		LOGWIN *lw;
		for ( i = 0; i < lModules.realCount; i++ )
		{
			lw = (LOGWIN*)lModules.items[i];
			ListView_SetBkColor(lw->hList, (COLORREF)lParam);
			ListView_SetTextBkColor(lw->hList, (COLORREF)lParam);
			if (wParam)
				SendMessage(lw->hList, WM_SETFONT, wParam, TRUE);
		}
		return TRUE;
	}
	case HM_PAUSEALL:
	{
		// lParam = 1 to pause, 0 to start
		int i;
		LOGWIN *lw;
		for ( i = 0; i < lModules.realCount; i++ )
		{
			lw = (LOGWIN*)lModules.items[i];
			if (lw->Paused != (int)lParam)
				SendMessage(lw->hwnd, WM_COMMAND, IDC_PAUSE, 0);
		}
		return TRUE;
	}
	case HM_RESTART:
	{
		if (pActive)
		{
			pActive = NULL;
			PostMessage(hwndDlg, HM_RESTART, 0, 0);
			return TRUE;
		}
		// close all tabs
		if (!lParam)
		{
			LOGWIN *lw;
			TabCtrl_DeleteAllItems(hTabs);
			while ( lModules.realCount )
			{
				lw = (LOGWIN*)lModules.items[0];
				SendMessage(lw->hwnd, WM_CLOSE, 0, 0);
			}
			tabCount = 0;
			PostMessage(hwndDlg, HM_RESTART, 0, 1);
			return TRUE;
		}

		LoadSettings();
		SendMessage(hwndDlg, HM_ADD, 0, 0);
		PostMessage(hwndDlg, WM_SIZE, 0, 0);
		return TRUE;
	}
 	case WM_SETFOCUS:
		if (pActive) {
			SetFocus(pActive->hList);
		}
		return TRUE;
	case WM_NOTIFY:
		switch(wParam) {
		case IDC_TABS:
			{
				LPNMHDR lpnmhdr = (LPNMHDR)lParam;
				if (lpnmhdr->code == TCN_SELCHANGE)
				{
					int newTab = TabCtrl_GetCurSel(hTabs);
					if (newTab >= 0 )
					{
						TCITEM tci={0};
						HWND hOld = pActive->hwnd;

						tci.mask = TCIF_PARAM;

						if (!TabCtrl_GetItem(hTabs, newTab, &tci)) break;

						pActive = (LOGWIN*)tci.lParam;

						SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
						ScrollDown(pActive);
						ShowWindow(hOld, SW_HIDE);
						ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE);
						SetFocus(pActive->hList);
					} else
						SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
				}
				break;
			}
		}
		break;
	case WM_SIZE:
	{
		UTILRESIZEDIALOG urd={0};
		urd.cbSize=sizeof(urd);
		urd.hInstance=hInst;
		urd.hwndDlg=hwndDlg;
		urd.lpTemplate=MAKEINTRESOURCEA(IDD_CONSOLE);
		urd.pfnResizer=ConsoleResize;
		CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd);

		GetClientRect(hTabs, &rcTabs);
		TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs);

		if ( pActive )
			SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
		break;
	}
	case WM_GETMINMAXINFO:
	{
		MINMAXINFO *mmi=(MINMAXINFO*)lParam;
		mmi->ptMinTrackSize.x=400;
		mmi->ptMinTrackSize.y=200;
		break;
	}
	case WM_CLOSE:
		if ( lParam != 1 ) {
			Utils_SaveWindowPosition(hwndDlg,NULL,"Console","Console");
			ShowConsole(0);
			return TRUE;
		} else
			DestroyWindow(hwndDlg);
		break;
	case WM_DESTROY:
		pActive = NULL;
		if (hfLogFont) DeleteObject(hfLogFont);
		PostQuitMessage(0);
		break;
	}

	return FALSE;
}