Ejemplo n.º 1
0
void ApplicationWindow::print()
{
#ifndef QT_NO_PRINTER
    MDIWindow* m = (MDIWindow*)ws->activeWindow();
    if ( m )
	m->print( printer );
#endif
}
wyBool
FrameWindowSplitter::Resizeall()
{
	MDIWindow	*	pcquerywnd = (MDIWindow*)GetWindowLongPtr(m_hwndparent, GWLP_USERDATA);

    CustomTab_SetPaintTimer(pcquerywnd->m_pctabmodule->m_hwnd);
	pcquerywnd->Resize();

	return wyTrue;
}
Ejemplo n.º 3
0
void ApplicationWindow::load()
{
    QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, this );
    if ( !fn.isEmpty() ) {
	MDIWindow* w = newDoc();
	w->load( fn );
    }  else {
	statusBar()->message( "Loading aborted", 2000 );
    }
}
Ejemplo n.º 4
0
void
EditorTab::Resize()
{
	RECT	    rcmain, rcvsplitter, rchsplitter;
	wyInt32     hpos, vpos, width, height;
    wyInt32     tabcount, selindex;
    CTCITEM	    item;

	MDIWindow       *pcquerywnd	        =(MDIWindow*)GetWindowLong(m_hwndparent, GWL_USERDATA);
	FrameWindowSplitter  *pcqueryvsplitter   = pcquerywnd->GetVSplitter();
	FrameWindowSplitter  *pcqueryhsplitter   = pcquerywnd->GetHSplitter();
	
	VERIFY(GetClientRect(m_hwndparent, &rcmain));

	VERIFY(GetWindowRect(pcqueryvsplitter->GetHwnd(), &rcvsplitter));
	VERIFY(GetWindowRect(pcqueryhsplitter->GetHwnd(), &rchsplitter));

	VERIFY(MapWindowPoints(NULL, m_hwndparent,(LPPOINT)&rcvsplitter, 2));
	VERIFY(MapWindowPoints(NULL, m_hwndparent,(LPPOINT)&rchsplitter, 2));

	hpos			=	(rcvsplitter.right);
	vpos			=	5;
	width			=	(rcmain.right - hpos) - 2;

	if(pcquerywnd->m_iseditwindow == wyTrue)
		height		=	(rchsplitter.top - rcvsplitter.top) - 3;
	else
		height		=	0;

	SendMessage(m_hwnd, WM_SETREDRAW,  FALSE, NULL);

	VERIFY(MoveWindow(m_hwnd, hpos, vpos, width, height, TRUE));

    SendMessage(m_hwnd, WM_SETREDRAW, TRUE, NULL);
	
    item.m_mask = CTBIF_LPARAM;

	selindex = CustomTab_GetCurSel(m_hwnd);

	for(tabcount = 0; tabcount < CustomTab_GetItemCount(m_hwnd); tabcount++)
	{
		CustomTab_GetItem(m_hwnd, tabcount, &item);
		EditorBase *eb =(EditorBase *)item.m_lparam;
		eb->Resize();		

        pGlobals->m_pcmainwin->m_connection->HandleEditorControls(eb->m_hwnd,
            eb->m_hwndhelp, eb->m_hwndfilename, eb->m_save, tabcount, selindex);
	}
			
	InvalidateRect(m_hwnd, NULL, TRUE);

	return;
}
Ejemplo n.º 5
0
MDIWindow* ApplicationWindow::newDoc()
{
    MDIWindow* w = new MDIWindow( ws, 0, WDestructiveClose );
    connect( w, SIGNAL( message(const QString&, int) ), statusBar(), SLOT( message(const QString&, int )) );
    w->setCaption("unnamed document");
    w->setIcon( QPixmap("document.xpm") );
    // show the very first window in maximized mode
    if ( ws->windowList().isEmpty() )
	w->showMaximized();
    else
	w->show();
    return w;
}
Ejemplo n.º 6
0
 foreach(QMdiSubWindow* window, subWindowList())
 {
     MDIWindow* mdiWin = qobject_cast<MDIWindow*>(window);
     if(mdiWin)
     {
         View* v = mdiWin->getView();
         if(v)
         {
             v->recalculateLimits();
             v->zoomExtents();
         }
     }
 }
Ejemplo n.º 7
0
wyBool
EditorBase::ShowResultWindow()
{
	wyInt32	      lstyle;
	wyUInt32	  menustate;
	wyUInt32	  ret;
	HMENU	      hmenu, hsubmenu;

	TabMgmt				*ptabmgmt;	
	TabEditorSplitter	*ptesplitter;
	MDIWindow	*	pCQueryWnd =(MDIWindow*)GetActiveWin();

	if (pCQueryWnd->GetActiveTabEditor()->m_isresultwnd)
		return wyTrue;

	VERIFY(hmenu = GetMenu(pGlobals->m_pcmainwin->m_hwndmain));

	lstyle = GetWindowLongPtr(pCQueryWnd->m_hwnd, GWL_STYLE);

	if ((lstyle & WS_MAXIMIZE) && wyTheme::IsSysmenuEnabled(pCQueryWnd->m_hwnd))
		VERIFY(hsubmenu = GetSubMenu(hmenu, 2));
	else
		VERIFY(hsubmenu = GetSubMenu(hmenu, 1));

	menustate = GetMenuState(hsubmenu, IDC_EDIT_SHOWRESULT, MF_BYCOMMAND);

	ret = CheckMenuItem(hsubmenu, IDC_EDIT_SHOWRESULT, MF_BYCOMMAND | MF_UNCHECKED);
	pCQueryWnd->GetActiveTabEditor()->m_isresultwnd = wyTrue;

	ptesplitter = pCQueryWnd->GetActiveTabEditor()->m_pcetsplitter;
	
	if(ptesplitter->m_leftortoppercent == ptesplitter->m_lasttoppercent && 
           ptesplitter->m_leftortoppercent == 100 && 
           ptesplitter->m_lasttoppercent == 100)
        {
            ptesplitter->m_lasttoppercent = 50;
            ptesplitter->m_leftortoppercent = ptesplitter->m_lasttoppercent;
        }
		else
            ptesplitter->m_leftortoppercent = ptesplitter->m_lasttoppercent;
		
	pCQueryWnd->m_pctabmodule->Resize();

	ptabmgmt = pCQueryWnd->GetActiveTabEditor()->m_pctabmgmt;

	VERIFY(UpdateWindow(ptabmgmt->m_hwnd));
	//VERIFY(UpdateWindow(ptabmgmt->m_pcdataviewquery->m_hwndgrid));

    return wyTrue;
}
Ejemplo n.º 8
0
wyBool 
ImportBatch::GetCurDatabase()
{
	wyInt32			ret;
    wyString        query;
	MYSQL_RES*		myres;
	MYSQL_ROW		myrow;
	wyString		myrowstr;
	MDIWindow		*wnd = GetActiveWin();
	wyBool			ismysql41 = wnd->m_ismysql41;

	query.Sprintf("select database()");

	wnd->SetThreadBusy(wyTrue);
	ret = my_query(wnd, m_tunnel, m_umysql, query.GetString(), query.GetLength());
	wnd->SetThreadBusy(wyFalse);
	if(ret)
	{
		ShowMySQLError(m_hwnd, m_tunnel, m_umysql, query.GetString());
		return wyFalse;
	}

	myres	=	m_tunnel->mysql_store_result(*m_umysql, false, false, GetActiveWin());
	if(!myres)
	{
		ShowMySQLError(m_hwnd, m_tunnel, m_umysql, query.GetString());
		return wyFalse;
	}

	myrow	=	m_tunnel->mysql_fetch_row(myres);
	if(myrow[0])
    {
		myrowstr.SetAs(myrow[0], ismysql41);
		strncpy(m_curdb, myrowstr.GetString(), myrowstr.GetLength());
    }
    else 
		m_curdb[0] = NULL;
	if( strlen(m_curdb) == 0)
		strcpy(m_curdb, "<None>");

        myrowstr.SetAs(m_curdb);
	SendMessage(GetDlgItem(m_hwnd, IDC_CURDATABASE), WM_SETTEXT, 0, (LPARAM)myrowstr.GetAsWideChar()); 		
	
	m_tunnel->mysql_free_result(myres);	

	return wyTrue;
}
Ejemplo n.º 9
0
wyBool
EditorBase::SelectFirstTableToEdit(wyBool isedit)
{	
	MDIWindow		*wnd = GetActiveWin();
    wyString        currenttable;
    ResultView*     presultview;

    if(!wnd || !wnd->GetActiveTabEditor() || 
		!wnd->GetActiveTabEditor()->m_pctabmgmt || 
        !(presultview = wnd->GetActiveTabEditor()->m_pctabmgmt->m_presultview))
    {
        return wyFalse;
    }
    
    presultview->SelectTableComboItem(isedit == wyTrue ? 1 : 0);
	return wyTrue;
}
Ejemplo n.º 10
0
HMENU
CFavoriteMenu::GetFavoriteMenu(HWND hwnd)
{
	MDIWindow		*wnd;
	wyInt32			lstyle;  // window style //
	HMENU			hmenu = NULL;
	
    wnd = ::GetActiveWin();

	hmenu  = ::GetSubMenu(GetMenu(hwnd), 2);
    
	if(wnd)
	{
        lstyle = ::GetWindowLongPtr(wnd->GetHwnd(), GWL_STYLE);
 
        /* Here we assumes that FAVORITES manu is on the 4th place(Since it is MAXIMIZED)*/
		if((lstyle & WS_MAXIMIZE) && wyTheme::IsSysmenuEnabled(wnd->m_hwnd))
            hmenu = ::GetSubMenu(GetMenu(hwnd), 3);
	}

	return hmenu;
}
void 
Announcements::Resize(HWND hwnd, wyBool isstart)
{
	RECT                rcmain, rcvsplitter;
	wyInt32             ret;
	wyInt32             hpos, vpos_ob, vpos, width, height, ob_height, ypos;
	MDIWindow			*wnd = (MDIWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
	FrameWindowSplitter	*pcqueryvsplitter = wnd->GetVSplitter();

	VERIFY(GetClientRect(hwnd, &rcmain));
	VERIFY(GetWindowRect(pcqueryvsplitter->GetHwnd(), &rcvsplitter));
	VERIFY(MapWindowPoints(NULL, hwnd,(LPPOINT)&rcvsplitter, 2));

	ob_height		=	wnd->m_pcqueryobject->m_height;
	hpos			=	2;
	ypos			=	2;
	vpos_ob			=	(ob_height + 10) > 22 ? ob_height + 10: 22;
	width			=	rcvsplitter.left-2;
	height			=	rcmain.bottom - (2 * vpos_ob) - 10;
	m_htmlh			=   (wyInt32)(0.3 * height);
	vpos			=	(vpos_ob * 2)+ 8 + height - m_htmlh; 

	if( wnd->m_isanncreate == wyFalse )	
	{
		VERIFY(ret = MoveWindow(m_hwndHTML, 0, ypos, width, m_htmlh, TRUE));
		m_htmlw = width;
	}
	else
	{
		VERIFY(ret = MoveWindow(m_hwndHTML, m_htmlx, ypos, width, m_htmlh, TRUE));
		m_htmlw = width;
	}

	if(!(wnd->m_isanncreate || isstart))
		wnd->m_isanncreate = wyTrue;

	VERIFY(ret = MoveWindow(m_hwnd, hpos, vpos-ypos, width, m_htmlh+2, TRUE));

}
wyBool
TabEditorSplitter::Resizeall()
{
	MDIWindow *wnd;
	//TabTypes   *tabtype;

	wnd = GetActiveWin();

	if(!wnd || !wnd->m_pctabmodule)
		return wyFalse;
	
    /*
	tabtype = wnd->m_pctabmodule->GetActiveTabType();

	if(!tabtype)
		return wyFalse;

    tabtype->Resize(wyTrue);
    */

    CustomTab_SetPaintTimer(wnd->m_pctabmodule->m_hwnd);
    wnd->Resize();
	return wyTrue;
}
Ejemplo n.º 13
0
void ApplicationWindow::closeWindow()
{
    MDIWindow* m = (MDIWindow*)ws->activeWindow();
    if ( m )
	m->close();
}
Ejemplo n.º 14
0
void ApplicationWindow::saveAs()
{
    MDIWindow* m = (MDIWindow*)ws->activeWindow();
    if ( m )
	m->saveAs();
}
Ejemplo n.º 15
0
// Subclass procedure for the edit box.
LRESULT	CALLBACK 
EditorBase::WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) 
{
	EditorBase *ebase = (EditorBase*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
    MDIWindow   *wnd = NULL;
	wyInt32		ret = 0;
		
	static wyChar	keyword[128];
	static wyBool	keyflag;
	static wyInt32  wrdlen = 0;

    VERIFY(wnd = GetActiveWin());
				
    //if message is from find replace dialog - pass it to the right handler
	//forced type cast
	if(message == (wyUInt32)pGlobals->m_pcmainwin->m_findmsg) 
	{		
		if( ebase->m_findreplace->FindReplace(hwnd, lparam) == wyFalse)
		{
            //when we are closing the find dialog, deleting the memory allocated for Find
			delete(ebase->m_findreplace);
			ebase->m_findreplace = NULL;
		}
		return 0;		
	}    
	
	switch(message)	
	{
	    case WM_HELP:
            ShowHelp("SQL%20Window%20SQLyog%20for%20MySQL%20Administration.htm");
		    return wyTrue;

	    case WM_CONTEXTMENU:
            if(wnd->GetActiveTabEditor())
		    {
			    //CustomGrid_ApplyChanges(wnd->GetActiveTabEditor()->m_pctabmgmt->m_insert->m_hwndgrid, wyTrue);
		    }

            if(ebase->OnContextMenu(lparam) == 1)
            {
                return 1;
            }
		    break;

	    case WM_KEYUP:
	        ebase->OnWMKeyUp(hwnd, wparam);
            break;
		
	    case WM_KEYDOWN:
		    {
			    //This needs to work Ctrl+X to be handled in WM_CHAR, if it wont return '0', that wont process as expected

			    if(GetKeyState(VK_CONTROL) & 0x8000)
			    {
				    if(wparam == 'X')
					    return 0;

				    if(wparam == VK_INSERT)
				    {
					    CopyStyledTextToClipBoard(hwnd);
					    return 0;
				    }
			    }
               
			    if(wnd->m_acinterface->HandlerOnWMKeyDown(hwnd, ebase, wparam))
				    return 1;
		    }
		    break;

        case WM_SYSKEYDOWN:
             if(lparam >> 29)
            {
                //check whether it is insert/delete
                if (wparam == 'C' || wparam == 'c')//switch(wparam)
                {
                    ret = ebase->OnWMChar(hwnd, wparam, wnd, ebase);
                }
            }
             break;

        case WM_SETFOCUS:
            if(wnd)
            {
                PostMessage(wnd->m_pctabmodule->m_hwnd, UM_SETSTATUSLINECOL, (WPARAM)hwnd, 1);
            }

            break;

        case WM_KILLFOCUS:
            if(wnd)
            {
                PostMessage(wnd->m_pctabmodule->m_hwnd, UM_SETSTATUSLINECOL, (WPARAM)NULL, 0);
            }

            break;		
		
	    case WM_LBUTTONUP:
		    ebase->OnLButtonUp(wnd,hwnd);
		    break;

	    case UM_FOCUS:
		    ::SendMessage(hwnd, SCI_GRABFOCUS, 0, 0);
		    break;

	    case WM_CHAR:

		    ret = ebase->OnWMChar(hwnd, wparam, wnd, ebase);

		    if(ret == -1)
			    break;

		    return ret;		

        case UM_ADDBACKQUOTEONAC:
            if(lparam & 1)
            {
                SendMessage(hwnd, SCI_INSERTTEXT, wparam, (LPARAM)"`");
            }

            if(lparam & 2)
            {
               SendMessage(hwnd, SCI_REPLACESEL, (WPARAM)0, (LPARAM)"`");
            }

            SendMessage(hwnd, SCI_ENDUNDOACTION, 0, 0);        
	}

	return CallWindowProc(ebase->wpOrigProc, hwnd, message, wparam, lparam);
}