Ejemplo n.º 1
0
BOOL XAP_Win32Dialog_Zoom::_onInitDialog(HWND hWnd, WPARAM /*wParam*/, LPARAM /*lParam*/)
{		
	const XAP_StringSet* pSS = m_pApp->getStringSet();

	// Update the caption
	setDialogTitle(pSS->getValue(XAP_STRING_ID_DLG_Zoom_ZoomTitle));

	// localize controls
	_DSX(ZOOM_BTN_CLOSE,		DLG_Close);
	_DS(ZOOM_TEXT_ZOOMTO,		DLG_Zoom_RadioFrameCaption);
	_DS(ZOOM_RADIO_200,		DLG_Zoom_200);
	_DS(ZOOM_RADIO_100,		DLG_Zoom_100);
	_DS(ZOOM_RADIO_75,		DLG_Zoom_75);
	_DS(ZOOM_RADIO_WIDTH,		DLG_Zoom_PageWidth);
	_DS(ZOOM_RADIO_WHOLE,		DLG_Zoom_WholePage);
	_DS(ZOOM_RADIO_PCT,		DLG_Zoom_Percent);

	// set initial state
	checkButton(XAP_RID_DIALOG_ZOOM_RADIO_200 + m_zoomType);
	setControlInt(XAP_RID_DIALOG_ZOOM_EDIT_PCT, (UINT) m_zoomPercent);
	m_bEditPctEnabled = ((XAP_RID_DIALOG_ZOOM_RADIO_200 + m_zoomType) == XAP_RID_DIALOG_ZOOM_RADIO_PCT);
	enableControl(XAP_RID_DIALOG_ZOOM_EDIT_PCT ,m_bEditPctEnabled);
	
	SendMessageW(GetDlgItem(hWnd,XAP_RID_DIALOG_ZOOM_SPIN_PCT),UDM_SETRANGE,
				(WPARAM)0,(LPARAM)MAKELONG(XAP_DLG_ZOOM_MAXIMUM_ZOOM,XAP_DLG_ZOOM_MINIMUM_ZOOM));
		
	_updatePreviewZoomPercent(getZoomPercent());
	
	centerDialog();	
	
	return 1;							// 1 == we did not call SetFocus()
}
Ejemplo n.º 2
0
void DataImportDlg::OnBnClickedDataImpotObjectListBtn()
{
    CFileDialog  openDialog(
        TRUE,
        _T( "txt" ),
        NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,
        _T( "txt文件(*.txt)|*.txt||" ) );

    if( IDOK == openDialog.DoModal() )
    {
        CString filePath = openDialog.GetPathName();
        GetDlgItem( IDC_DATA_INPUT_OBJECT_LIST )->SetWindowText( filePath );

        enableControl( IDC_DATA_IMPORT_INT_LIST_BTN,  _T( "请等待" ), false );
        DataInitHelper::InitDataObjectList( filePath );
        enableControl( IDC_DATA_IMPORT_INT_LIST_BTN,  _T( "导入" ), true );
        MessageBox( _T( "导入完毕!" ) );
    }
}
void XAP_Win32Dialog_HTMLOptions::refreshStates()
{
	// determine which controls are available.
	enableControl(XAP_RID_DIALOG_HTMLOPTIONS_CHK_XML,can_set_Declare_XML());
	enableControl(XAP_RID_DIALOG_HTMLOPTIONS_CHK_AWML,can_set_Allow_AWML());
	enableControl(XAP_RID_DIALOG_HTMLOPTIONS_CHK_EMBEDCSS,can_set_Embed_CSS());
	enableControl(XAP_RID_DIALOG_HTMLOPTIONS_CHK_URLIMAGE,can_set_Embed_Images());
	enableControl(XAP_RID_DIALOG_HTMLOPTIONS_CHK_SPLITFILE,can_set_Split_Document());

	// set initial state
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_HTML4,get_HTML4());
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_PHP,get_PHTML()); 
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_XML,get_Declare_XML());
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_AWML,get_Allow_AWML());
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_EMBEDCSS,get_Embed_CSS());
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_URLIMAGE,get_Embed_Images());
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_PNGMATHML,get_MathML_Render_PNG());
	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_SPLITFILE,get_Split_Document());
}
void AP_Win32Dialog_Columns::enableLineBetweenControl(bool bState)
{
	// As this function gets called prior to getting an hWnd for the dialog
	// we check to see if the dialog has been initialized prior to
	// running the conrol
	if ( isDialogValid() )
	{
		enableControl(AP_RID_DIALOG_COLUMN_CHECK_LINE_BETWEEN, bState);
	}
}
Ejemplo n.º 5
0
ProxyDialog::ProxyDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ProxyDialog)
{
    ui->setupUi(this);

    CWizSettings settings(Utils::PathResolve::globalSettingsFile());
    ui->editAddress->setText(settings.GetProxyHost());
    ui->editPort->setText(WizIntToStr(settings.GetProxyPort()));
    ui->editUserName->setText(settings.GetProxyUserName());
    ui->editPassword->setText(settings.GetProxyPassword());
    ui->editPassword->setEchoMode(QLineEdit::Password);
    ui->comboBox->setCurrentIndex((int)settings.GetProxyType());

    bool proxyStatus = settings.GetProxyStatus();
    ui->checkProxyStatus->setChecked(proxyStatus);

    enableControl(proxyStatus);

    connect(ui->checkProxyStatus, SIGNAL(stateChanged(int)), SLOT(proxyStatusChanged(int)));
}
Ejemplo n.º 6
0
// --------------------------------------------------
LRESULT CALLBACK GUIProc (HWND hwnd, UINT message,
                                 WPARAM wParam, LPARAM lParam)
{

	static const struct 
		{
			LRESULT from; // 変換元
			LRESULT to;   // 変換先
		}
	trans[] = 
		{
			{ HTLEFT,        HTBORDER }, // 左端の左右矢印 → 矢印なし
			{ HTRIGHT,       HTBORDER }, // 右端の左右矢印 → 矢印なし
			{ HTTOPLEFT,     HTTOP    }, // 左上隅の斜め矢印 → 縦矢印
			{ HTTOPRIGHT,    HTTOP    }, // 右上隅の斜め矢印 → 縦矢印
			{ HTBOTTOMLEFT,  HTBOTTOM }, // 左下隅の斜め矢印 → 縦矢印
			{ HTBOTTOMRIGHT, HTBOTTOM }, // 右下隅の斜め矢印 → 縦矢印
			{ HTTOP,         HTTOP    },
			{ HTBOTTOM,      HTBOTTOM }
		};


	bool rectflg = false;

   switch (message)
   {
       case WM_INITDIALOG:
			guiWnd = hwnd;

			shownChannels = false;
			logID = IDC_LIST1;		// log
			statusID = IDC_LIST2;	// status
			hitID = IDC_LIST4;		// hit
			chanID = IDC_LIST3;		// channels

			enableControl(IDC_BUTTON8,false);
			enableControl(IDC_BUTTON11,false);
			enableControl(IDC_BUTTON10,false);
			
			peercastApp->updateSettings();

			if (servMgr->autoServe)
				setButtonState(IDC_CHECK1,true);
			if (servMgr->autoConnect)
				setButtonState(IDC_CHECK2,true);


			guiThread.func = showConnections;
			if (!sys->startThread(&guiThread))
			{
				MessageBox(hwnd,"Unable to start GUI","PeerCast",MB_OK|MB_ICONERROR);
				PostMessage(hwnd,WM_DESTROY,0,0);
			}

			if (guiFlg){
				SetWindowPlacement(hwnd, &winPlace);
			}

			{	// for PCRaw (connection list)
				HWND hwndList;
				
				hwndList = GetDlgItem(guiWnd, chanID);
#ifndef WIN64
				wndOldListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
				SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ListBoxProc);

				hwndList = GetDlgItem(guiWnd, statusID);
				wndOldConnListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
				SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ConnListBoxProc);
#else
				wndOldListBox = (WNDPROC)GetWindowLongPtr(hwndList, GWLP_WNDPROC);
				SetWindowLongPtr(hwndList, GWLP_WNDPROC, (DWORD)ListBoxProc);

				hwndList = GetDlgItem(guiWnd, statusID);
				wndOldConnListBox = (WNDPROC)GetWindowLongPtr(hwndList, GWLP_WNDPROC);
				SetWindowLongPtr(hwndList, GWLP_WNDPROC, (DWORD)ConnListBoxProc);
#endif
			}

			break;

	  case WM_COMMAND:
			switch( wParam )
			{
				case IDC_CHECK1:		// start server
						if (getButtonState(IDC_CHECK1))
						{
							//SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Deactivate");

							SendDlgItemMessage(hwnd, IDC_EDIT3,WM_GETTEXT, 64, (LONG)servMgr->password);

							servMgr->serverHost.port = (unsigned short)getEditInt(IDC_EDIT1);
							servMgr->setMaxRelays(getEditInt(IDC_MAXRELAYS));


							enableControl(IDC_EDIT1,false);
							enableControl(IDC_EDIT3,false);
							enableControl(IDC_MAXRELAYS,false);
							enableControl(IDC_BUTTON8,true);
							enableControl(IDC_BUTTON11,true);
							enableControl(IDC_BUTTON10,true);

							//writeSettings();
							servMgr->autoServe = true;

							setEditStr(IDC_CHECK1,"Enabled");


						}else{
							//SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Activate");

							servMgr->autoServe = false;

							enableControl(IDC_EDIT1,true);
							enableControl(IDC_EDIT3,true);
							enableControl(IDC_MAXRELAYS,true);
							enableControl(IDC_BUTTON8,false);
							enableControl(IDC_BUTTON11,false);
							enableControl(IDC_BUTTON10,false);

							setEditStr(IDC_CHECK1,"Disabled");

						}
						setControls(true);

					break;
				case IDC_CHECK11:		// DJ message
					if (getButtonState(IDC_CHECK11))
					{
						enableControl(IDC_EDIT9,false);
						SendDlgItemMessage(hwnd, IDC_EDIT9,WM_GETTEXT, 128, (LONG)chanMgr->broadcastMsg.cstr());
					}else{
						enableControl(IDC_EDIT9,true);
						chanMgr->broadcastMsg.clear();
					}
					break;
				case IDC_LOGDEBUG:		// log debug
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_DEBUG) : servMgr->showLog&~(1<<LogBuffer::T_DEBUG);
					break;
				case IDC_LOGERRORS:		// log errors
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_ERROR) : servMgr->showLog&~(1<<LogBuffer::T_ERROR);
					break;
				case IDC_LOGNETWORK:		// log network
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_NETWORK) : servMgr->showLog&~(1<<LogBuffer::T_NETWORK);
					break;
				case IDC_LOGCHANNELS:		// log channels
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_CHANNEL) : servMgr->showLog&~(1<<LogBuffer::T_CHANNEL);
					break;
				case IDC_CHECK9:		// pause log
					servMgr->pauseLog = getButtonState(wParam);
					break;
				case IDC_CHECK2:		// start outgoing

					if (getButtonState(IDC_CHECK2))
					{

						SendDlgItemMessage(hwnd, IDC_COMBO1,WM_GETTEXT, 128, (LONG)servMgr->connectHost);
						servMgr->autoConnect = true;
						//SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Disconnect");
						enableControl(IDC_COMBO1,false);
					}else{
						servMgr->autoConnect = false;
						//SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Connect");
						enableControl(IDC_COMBO1,true);
					}
					break;
				case IDC_BUTTON11:		// broadcast
					{
						Host sh = servMgr->serverHost;
						if (sh.isValid())
						{
							char cmd[256];
							sprintf(cmd,"http://localhost:%d/admin?page=broadcast",sh.port);
							ShellExecute(hwnd, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
		
						}else{
							MessageBox(hwnd,"Server is not currently connected.\nPlease wait until you have a connection.","PeerCast",MB_OK);
						}
					}
					break;
				case IDC_BUTTON8:		// play selected
					{
						Channel *c = getListBoxChannel();
						if (c){
							chanMgr->playChannel(c->info);
						}
					}
					break;
				case IDC_BUTTON7:		// advanced
					sys->callLocalURL("admin?page=settings",servMgr->serverHost.port);
					break;
				case IDC_BUTTON6:		// servent disconnect
					{
/*						Servent *s = (Servent *)getListBoxSelData(statusID);
						if (s)
							s->thread.active = false;*/
						Servent *s = getListBoxServent();
						if (s){
							s->thread.active = false;
							s->thread.finish = true;
						}
						sleep_skip = true;
					}
					break;
				case IDC_BUTTON5:		// chan disconnect
					{
/*						Channel *c = (Channel *)getListBoxSelData(chanID);
						if (c)
							c->thread.active = false;*/

//						Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
						Channel *c = getListBoxChannel();
						if (c){
							c->thread.active = false;
							c->thread.finish = true;
						}
						sleep_skip = true;
					}
					break;
				case IDC_BUTTON3:		// chan bump
					{
/*						Channel *c = (Channel *)getListBoxSelData(chanID);
						if (c)
							c->bump = true;*/

//						Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
						Channel *c = getListBoxChannel();
						if (c){
							c->bump = true;
						}
					}

					break;
				case IDC_BUTTON4:		// get channel 
					{
						ChanHitList *chl = (ChanHitList *)getListBoxSelData(hitID);
						if (chl)
						{
							if (!chanMgr->findChannelByID(chl->info.id))
							{
								Channel *c = chanMgr->createChannel(chl->info,NULL);
								if (c)
									c->startGet();
							}
						}else{
							MessageBox(hwnd,"Please select a channel","PeerCast",MB_OK);
						}
					}
					break;

					case IDC_BUTTON9:		//JP-EX chan keep
					{
/*						Channel *c = (Channel *)getListBoxSelData(chanID);
						if (c)
						{
							if (!c->stayConnected)
							{
								//if (servMgr->getFirewall() == ServMgr::FW_OFF)
								c->stayConnected = true;
							}	
							else
								c->stayConnected = false;
						}*/

//						Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
						Channel *c = getListBoxChannel();
						if (c){
							if (!c->stayConnected){
								c->stayConnected = true;
							} else {
								c->stayConnected = false;
							}
						}
					}
					break;

				case IDC_BUTTON1:		// clear log
					SendDlgItemMessage(guiWnd, logID, LB_RESETCONTENT, 0, 0);
					sys->logBuf->clear();	// for PCRaw (clear log)
					break;

				case IDC_BUTTON2:		// find
					{
						char str[64];
						SendDlgItemMessage(hwnd, IDC_EDIT2,WM_GETTEXT, 64, (LONG)str);
						SendDlgItemMessage(hwnd, hitID, LB_RESETCONTENT, 0, 0);
						ChanInfo info;
						info.init();
						info.name.set(str);
						chanMgr->startSearch(info);
					}
					break;

			}
			break;

		case WM_MEASUREITEM:
			if ((UINT) wParam==IDC_LIST3){
				LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
				lpMI->itemHeight = 12;
			} else if ((UINT) wParam==IDC_LIST2){
				LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
				lpMI->itemHeight = 12;
			}
			break;
		case WM_DRAWITEM:
			if  ((UINT) wParam==IDC_LIST3)
			{
				LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
				HBRUSH   hBrush;
				ListData *ld;
				unsigned int idx = 0;
				bool flg = false;

				ld = list_top;
				while(ld){
					if (_DrawItem->itemID == idx){
						flg = true;
						break;
					}
					ld = ld->next;
					idx++;
				}
				if ((_DrawItem->itemState) & (ODS_SELECTED))
				{
					hBrush=CreateSolidBrush(RGB(49,106,197));
				}
				else  
				{
					hBrush=CreateSolidBrush(RGB(255,255,255));
				}
				FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);                   
				DeleteObject(hBrush);
				if (flg){
					char buf[256];
					if (ld->status == Channel::S_RECEIVING){
						if (ld->chDisp.status == Channel::S_RECEIVING){
							if (ld->chDisp.relay){
								/* relay ok */
								SetTextColor(_DrawItem->hDC,RGB(0,255,0));
								SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
							} else {
								/* no more relay */
								if (ld->chDisp.numRelays){
									/* relay full */
									SetTextColor(_DrawItem->hDC,RGB(0,0,255));
									SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
								} else {
									/* relay ng */
									SetTextColor(_DrawItem->hDC,RGB(255,0,255));
									SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
								}
							}
						} else {
							/* status unmatch */
							SetTextColor(_DrawItem->hDC,RGB(0,0,0));
							SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
						}
						TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left,
							_DrawItem->rcItem.top,
							"■",
							2);
					} else {
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
						SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
						TextOut(_DrawItem->hDC,
								_DrawItem->rcItem.left,
								_DrawItem->rcItem.top,
								"□",
								2);
					}
					if ((_DrawItem->itemState) & (ODS_SELECTED))
					{
						SetTextColor(_DrawItem->hDC,RGB(255,255,255));
						SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
					} else {
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
						SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
					}
					if (servMgr->getFirewall() == ServMgr::FW_ON){
						SetTextColor(_DrawItem->hDC,RGB(255,0,0));
					} else if (ld->bTracker && (ld->status == Channel::S_RECEIVING)){
						if ((_DrawItem->itemState) & (ODS_SELECTED))
						{
							SetTextColor(_DrawItem->hDC,RGB(0,255,0));
							SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
						} else {
							SetTextColor(_DrawItem->hDC,RGB(0,128,0));
						}
					}

					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12,
							_DrawItem->rcItem.top,
							ld->name,
							strlen(ld->name));
/*					sprintf(buf, "- %4dkbps -", ld->bitRate);
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118 + 80,
							_DrawItem->rcItem.top,
							ld->statusStr,
							strlen(ld->statusStr));
					sprintf(buf, "- %3d/%3d - [%3d/%3d] -", ld->totalListeners, ld->totalRelays, ld->localListeners, ld->localRelays);
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118 + 80 + 80,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
					strcpy(buf, ld->stayConnected?"YES":"NO");
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118 + 80 + 80 + 130,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));*/
					sprintf(buf, "- %4dkbps - %s - %3d/%3d - [%3d/%3d] - %s",
						ld->bitRate,
						ld->statusStr,
						ld->totalListeners,
						ld->totalRelays,
						ld->localListeners,
						ld->localRelays,
						ld->stayConnected?"YES":"NO");
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
				}
			} else if  ((UINT) wParam==IDC_LIST2) {
				LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
				HBRUSH   hBrush;
				ServentData *sd;
				unsigned int idx = 0;
				bool flg = false;

				sd_lock.on();

				sd = servent_top;
				while(sd){
					if (_DrawItem->itemID == idx){
						flg = true;
						break;
					}
					sd = sd->next;
					idx++;
				}
				if (flg){
					char buf[256];
					char hostName[64];
					sd->h.toStr(hostName);

					if ((_DrawItem->itemState) & (ODS_SELECTED))
					{
						hBrush=CreateSolidBrush(RGB(49,106,197));
					}
					else  
					{
						hBrush=CreateSolidBrush(RGB(255,255,255));
					}
					FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);                   
					DeleteObject(hBrush);

					if (sd->infoFlg){
						if (sd->relay){
							/* relay ok */
							SetTextColor(_DrawItem->hDC,RGB(0,255,0));
//							SetBkColor(_DrawItem->hDC,RGB(255,255,255));
						} else {
							/* no more relay */
							if (sd->numRelays){
								/* relay full */
								SetTextColor(_DrawItem->hDC,RGB(0,0,255));
//								SetBkColor(_DrawItem->hDC,RGB(255,255,255));
							} else {
								/* relay ng */
								SetTextColor(_DrawItem->hDC,RGB(255,0,255));
//								SetBkColor(_DrawItem->hDC,RGB(255,255,255));
							}
						}
					} else {
						/* no info */
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
//						SetBkColor(_DrawItem->hDC,RGB(255,255,255));
					}

					if (sd->lastSkipTime + 120 > sys->getTime()){
						SetBkColor(_DrawItem->hDC,RGB(128,128,128));
						if (sd->type == Servent::T_RELAY){
							sprintf(buf, "▼(%d)",sd->lastSkipCount);
							TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
						} else {
							SetTextColor(_DrawItem->hDC,RGB(0,0,0));
							sprintf(buf, "▽(%d)",sd->lastSkipCount);
							TextOut(_DrawItem->hDC,
									_DrawItem->rcItem.left,
									_DrawItem->rcItem.top,
									buf,
									strlen(buf));
						}
					} else {
						SetBkColor(_DrawItem->hDC,RGB(255,255,255));
						if (sd->type == Servent::T_RELAY){
							TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left,
							_DrawItem->rcItem.top,
							"■",
							2);
						} else {
							SetTextColor(_DrawItem->hDC,RGB(0,0,0));
							SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
							TextOut(_DrawItem->hDC,
									_DrawItem->rcItem.left,
									_DrawItem->rcItem.top,
									"□",
									2);
						}
					}

					if ((_DrawItem->itemState) & (ODS_SELECTED))
					{
						SetTextColor(_DrawItem->hDC,RGB(255,255,255));
						SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
					} else {
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
						SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
					}
					if (sd->firewalled){
						if (!sd->numRelays){
							SetTextColor(_DrawItem->hDC,RGB(255,0,0));
						} else {
							SetTextColor(_DrawItem->hDC,RGB(255,168,0));
						}
					}

					char buf2[16];
					if (sd->ver_ex_number){
						sprintf(buf2, "(%c%c%04d)", sd->ver_ex_prefix[0], sd->ver_ex_prefix[1], sd->ver_ex_number);
					} else if (sd->vp_ver){
						sprintf(buf2, "(VP%04d)", sd->vp_ver);
					} else {
						buf2[0] = '\0';
					}
					if (sd->type == Servent::T_RELAY){
						if (sd->status == Servent::S_CONNECTED){
							sprintf(buf, "(%d)RELAYING-%ds  - %d/%d -  %s  -  %d - %s%s",
								sd->lastSkipCount,
								sd->tnum,
								sd->totalListeners, sd->totalRelays,
								hostName,
								sd->syncpos, sd->agent.cstr(), buf2
								);
						} else {
							sprintf(buf, "%s-%s-%ds  - %d/%d -  %s  -  %d - %s%s",
								sd->typeStr, sd->statusStr, sd->tnum,
								sd->totalListeners, sd->totalRelays,
								hostName,
								sd->syncpos, sd->agent.cstr(), buf2
								);
						}
					} else if (sd->type == Servent::T_DIRECT){
						sprintf(buf, "%s-%s-%ds  -  %s  -  %d - %s ",
							sd->typeStr, sd->statusStr, sd->tnum,
							hostName,
							sd->syncpos, sd->agent.cstr()
							);
					} else {
						if (sd->status == Servent::S_CONNECTED){
							sprintf(buf, "%s-%s-%ds  -  %s  -  %d/%d",
								sd->typeStr, sd->statusStr, sd->tnum,
								hostName,
								sd->syncpos, sd->agent.cstr()
								);
						} else {
							sprintf(buf, "%s-%s-%ds  -  %s",
								sd->typeStr, sd->statusStr, sd->tnum,
								hostName
								);
						}
					}
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
				}
				sd_lock.off();
			}
			break;

		case WM_SIZE:
			MoveControls(lParam);
			break;

		case WM_GETMINMAXINFO:
		{
			MINMAXINFO *pmmi = (MINMAXINFO *)lParam;
			if ( pmmi )
			{
				pmmi->ptMinTrackSize.x = 530;  // 最小幅
				pmmi->ptMinTrackSize.y = 435;  // 最小高
				pmmi->ptMaxTrackSize.x = 530; // 最大幅
				pmmi->ptMaxTrackSize.y = 1200;  // 最大高
			}
			return 0;
		}

/*		case WM_NCHITTEST:
		{
			LRESULT lResult; // カーソル位置判定結果

			// 変換一覧にあれば変換した値を返す。
			lResult = DefWindowProc( guiWnd, message, wParam, lParam );
			for( int i = 0; i < 8; i++ )
			{
				if ( lResult == trans[ i ].from )
				{
					return trans[ i ].to;
				}
			}
//			return lResult;
//			return HTCAPTION;
//			return 0;
		}*/
		
		case WM_CLOSE:
			GetWindowPlacement(hwnd, &winPlace);
			guiFlg = true;
			DestroyWindow( hwnd );
			break;

		case WM_DESTROY:
			GetWindowPlacement(hwnd, &winPlace);
			guiFlg = true;
			guiThread.active = false;
//			guiThread.lock();
			guiWnd = NULL;
//			guiThread.unlock();
			EndDialog(hwnd, LOWORD(wParam));
			break;

		//default:
			// do nothing
			//return DefDlgProc(hwnd, message, wParam, lParam);		// this recurses for ever
			//return DefWindowProc(hwnd, message, wParam, lParam);	// this stops window messages
   }
   return 0;
}
Ejemplo n.º 7
0
void ProxyDialog::proxyStatusChanged(int state)
{
    enableControl(Qt::Checked == state);
}
Ejemplo n.º 8
0
BOOL XAP_Win32Dialog_Zoom::_onCommand(HWND hWnd, WPARAM wParam, LPARAM /*lParam*/)
{
	WORD wId = LOWORD(wParam);
	UT_sint32 newValue;

	m_bEditPctEnabled = (isChecked(XAP_RID_DIALOG_ZOOM_RADIO_PCT)==BST_CHECKED);
	enableControl(XAP_RID_DIALOG_ZOOM_EDIT_PCT,m_bEditPctEnabled);
	
	switch (wId)
	{
	case XAP_RID_DIALOG_ZOOM_RADIO_200:
		m_zoomType = XAP_Frame::z_200;
		m_pFrame->setZoomType(m_zoomType);
		_updatePreviewZoomPercent(200);
		return 1;

	case XAP_RID_DIALOG_ZOOM_RADIO_100:
		m_zoomType = XAP_Frame::z_100;
		m_pFrame->setZoomType(m_zoomType);
		_updatePreviewZoomPercent(100);
		return 1;

	case XAP_RID_DIALOG_ZOOM_RADIO_75:
		m_zoomType = XAP_Frame::z_75;
		m_pFrame->setZoomType(m_zoomType);
		_updatePreviewZoomPercent(75);
		return 1;

	case XAP_RID_DIALOG_ZOOM_RADIO_WIDTH:
		newValue = m_pFrame->getCurrentView()->calculateZoomPercentForPageWidth();
		m_zoomType = XAP_Frame::z_PAGEWIDTH;
		m_pFrame->setZoomType(m_zoomType);
		_updatePreviewZoomPercent(newValue);
		return 1;

	case XAP_RID_DIALOG_ZOOM_RADIO_WHOLE:
		newValue = m_pFrame->getCurrentView()->calculateZoomPercentForWholePage();
		m_zoomType = XAP_Frame::z_WHOLEPAGE;
		m_pFrame->setZoomType(m_zoomType);
		_updatePreviewZoomPercent(newValue);
		return 1;

	case XAP_RID_DIALOG_ZOOM_RADIO_PCT:
		if (m_bEditPctEnabled)
		{
			if (_getValueFromEditPct(&newValue))
			{
				m_zoomType = XAP_Frame::z_PERCENT;
				m_pFrame->setZoomType(m_zoomType);
				m_zoomPercent = newValue;
				_updatePreviewZoomPercent(newValue);
			}
		}
		return 1;

	case XAP_RID_DIALOG_ZOOM_EDIT_PCT:
		if (_getValueFromEditPct(&newValue))
		{
			m_zoomPercent = newValue;
			_updatePreviewZoomPercent(newValue);
		}
		return 1;
			
	case IDCANCEL:						// Zoom is instant-apply, so treat cancel as OK
	case IDOK:							// also XAP_RID_DIALOG_ZOOM_BTN_CLOSE
		m_answer = a_OK; 
		EndDialog(hWnd,0);
		return 1;

	default:							// we did not handle this notification
		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
		return 0;						// return zero to let windows take care of it.
	}
}