void CFontTexCreaterDlg::OnBnClickedExe()
{
	CComboBox* ccb = (CComboBox*)GetDlgItem(IDC_COMBO1) ;
	if( !ccb )
		return ;

	// font type
	int sel = ccb->GetCurSel() ;
	func_setFontInd( g_nFtIns , sel ) ;

	// texture size
	int texW = 1024 ;
	int texH = 1024 ;

	CEdit* pEdt = (CEdit*)GetDlgItem( IDC_EDT_TEXTURE_W ) ;
	if( pEdt )
	{
		wchar_t buf[256] ;
		pEdt->GetWindowText( buf , 256 ) ;
		texW = _wtoi( buf ) ;
	}

	pEdt = (CEdit*)GetDlgItem( IDC_EDT_TEXTURE_H ) ;
	if( pEdt )
	{
		wchar_t buf[256] ;
		pEdt->GetWindowText( buf , 256 ) ;
		texH = _wtoi( buf ) ;
	}

	char *canvas = new char[texW*texH] ;
	memset( canvas , 0 , texW*texH ) ;

	func_setCanvas( g_nFtIns ,canvas , texW , texH , 0 ) ;

	func_drawGlyphFromFile( g_nFtIns , "finalCode.txt" ) ;
	//func_drawAllGlyphs( g_nFtIns ) ;

	//
	{
		FreeImage_Initialise() ;

		FIBITMAP* bm = FreeImage_Allocate( texW , texH , 24 ) ;

		RGBQUAD clr ;

		for( int y = 0 ; y < texH ; y ++ )
		{
			for( int x = 0 ; x < texW ; x ++ )
			{
				char val = canvas[ y * texW + x ] ;

				clr.rgbBlue = val ;
				clr.rgbGreen = val ;
				clr.rgbRed = val ;
				clr.rgbReserved = 255 ;

				FreeImage_SetPixelColor( bm , x , texH - 1 - y , &clr ) ;
			}
		}
		//memcpy( bm->data , canvas , texW*texH ) ;

		FreeImage_Save( FIF_BMP , bm , "fontTex.bmp" ) ;

		FreeImage_Unload( bm ) ;

		FreeImage_DeInitialise() ;
	}

	//

	FILE* pf = fopen( "fontBuf" , "wb+" ) ;
	fwrite( canvas , texW * texH , 1 , pf ) ;
	fclose( pf ) ;

	//delete []canvas ;
}
Example #2
0
void CEditBar::OnKillFocus()
{
    CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
    pEdit->GetSel(m_nCurSelStart , m_nCurSelEnd);
}
Example #3
0
void campaign_tree_view::OnLButtonDown(UINT nFlags, CPoint point) 
{
	int i;
	CString str;
	CEdit *box;
	CListBox *listbox;
	CClientDC dc(this);

	OnPrepareDC(&dc);
	dc.DPtoLP(&point);
	if (nFlags & MK_CONTROL) {
		listbox = (CListBox *) &Campaign_tree_formp->m_filelist;
		i = listbox->GetCurSel();

		Mission_dropping = -1;
		if (i != LB_ERR) {
			Mission_dropping = i;
			SetCapture();
		}

		Last_draw_size = CSize(0, 0);
		Dragging_rect.SetRect(0, 0, 1, 1);
		dc.DrawDragRect(Dragging_rect, Last_draw_size, NULL, CSize(0, 0));

	} else {
		if ( (Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_loop) {
			// HACK!!  UPDATE mission loop desc before changing selections
			// save mission loop desc
			char buffer[MISSION_DESC_LENGTH];
			box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_MISSISON_LOOP_DESC);
			box->GetWindowText(buffer, MISSION_DESC_LENGTH);
			if (strlen(buffer)) {
				if (Links[Cur_campaign_link].mission_loop_txt) {
					free(Links[Cur_campaign_link].mission_loop_txt);
				}
				Links[Cur_campaign_link].mission_loop_txt = strdup(buffer);
			} else {
				Links[Cur_campaign_link].mission_loop_txt = NULL;
			}

			// HACK!!  UPDATE mission loop desc before changing selections
			// save mission loop desc			
			box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_LOOP_BRIEF_ANIM);
			box->GetWindowText(buffer, MISSION_DESC_LENGTH);
			if (strlen(buffer)) {
				if (Links[Cur_campaign_link].mission_loop_brief_anim) {
					free(Links[Cur_campaign_link].mission_loop_brief_anim);
				}
				Links[Cur_campaign_link].mission_loop_brief_anim = strdup(buffer);
			} else {
				Links[Cur_campaign_link].mission_loop_brief_anim = NULL;
			}

			// HACK!!  UPDATE mission loop desc before changing selections
			// save mission loop desc			
			box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_LOOP_BRIEF_SOUND);
			box->GetWindowText(buffer, MISSION_DESC_LENGTH);
			if (strlen(buffer)) {
				if (Links[Cur_campaign_link].mission_loop_brief_sound) {
					free(Links[Cur_campaign_link].mission_loop_brief_sound);
				}
				Links[Cur_campaign_link].mission_loop_brief_sound = strdup(buffer);
			} else {
				Links[Cur_campaign_link].mission_loop_brief_sound = NULL;
			}
		}
		Mission_dragging = Cur_campaign_mission = Cur_campaign_link = -1;
		for (i=0; i<Campaign.num_missions; i++)
			if (Elements[i].box.PtInRect(point)) {
				SetCapture();

				Mission_dragging = Cur_campaign_mission = i;
				Dragging_rect = Elements[i].box;
				Rect_offset = Dragging_rect.TopLeft() - point;
				Last_draw_size = CSize(4, 4);
				if (Campaign.missions[Cur_campaign_mission].num_goals < 0)  // haven't loaded goal names yet (or notes)
					read_mission_goal_list(Cur_campaign_mission);

				if (Campaign.missions[Cur_campaign_mission].notes) {
					str = convert_multiline_string(Campaign.missions[Cur_campaign_mission].notes);
					box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_HELP_BOX);
					if (box)
						box->SetWindowText(str);
				}

				Campaign_tree_formp->mission_selected(Cur_campaign_mission);
				break;
			}
	}
	
	Invalidate();
	UpdateWindow();
	Campaign_tree_formp->load_tree();
	if (Mission_dragging != -1) {
		CRect rect = Dragging_rect;

		dc.LPtoDP(&rect);
		dc.DrawDragRect(rect, Last_draw_size, NULL, CSize(0, 0));
	}

	CScrollView::OnLButtonDown(nFlags, point);
}
Example #4
0
void CAddBlogInfoDlg::OnOK() 
{
    // 入力内容チェック
    CEdit   *p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGUSERNAME );
    p->GetWindowText( m_blogUserName );
    if ( m_blogUserName.GetLength() == 0 ) {
        MessageBox( "「ユーザ名、または ID」を設定してください    ",
                    "設定確認", MB_OK|MB_ICONWARNING );
        return;
    }

    p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGPASSWORD );
    p->GetWindowText( m_blogPassword );
    if ( m_blogPassword.GetLength() == 0 ) {
        MessageBox( "「パスワード」を設定してください    ",
                    "設定確認", MB_OK|MB_ICONWARNING );
        return;
    }

    if ( m_blogKind == unset ) {
        MessageBox( "「blog の種類」を設定してください    ",
                    "設定確認", MB_OK|MB_ICONWARNING );
        return;
    }

    p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
    p->GetWindowText( m_blogName );
    if ( m_blogName.GetLength() == 0 ) {
        if ( (m_blogKind == movableType)  ||
             (m_blogKind == bloggerAPI)   ||
             (m_blogKind == metaWeblog)   ||
             (m_blogKind == mtAPI)        ||
             (m_blogKind == atomAPI)      ||
             (m_blogKind == newPostOnly)  ||   
             (m_blogKind == typepad)      ||
             (m_blogKind == typepadJapan) ||
             (m_blogKind == cocolog)      ||
             (m_blogKind == cocologFree)  ||
             (m_blogKind == blogzine)     ||
             (m_blogKind == newsHandler)  ||
             (m_blogKind == ameblo)       ||
             (m_blogKind == seesaa)       ||
             (m_blogKind == netLaputa)    ||
             (m_blogKind == blogG)        ||
             (m_blogKind == fc2blog)      ||
             (m_blogKind == gooBlog)      ||
             (m_blogKind == msnSpaces)    ||
             (m_blogKind == drecomX)      ||
             (m_blogKind == yaplogX)      ||
             (m_blogKind == jugemX)       ||
             (m_blogKind == webryX)       ||
             (m_blogKind == livedoor)     ||
             (m_blogKind == lovelog)      ||
             (m_blogKind == sonet)        ||
             (m_blogKind == vox)          ||
             (m_blogKind == hatena)       ||
             (m_blogKind == blogger)      ||
             (m_blogKind == exciteBlog)   ||
             (m_blogKind == echoo)        ||
             (m_blogKind == rakuten)         ) {
            // 追加情報取得
            OnButtonMoreInfo();
        }

        if ( m_blogName.GetLength() == 0 ) {
            MessageBox( "「blog 名」を設定してください    ",
                        "設定確認", MB_OK|MB_ICONWARNING );
            return;
        }
    }

    if ( (m_blogKind == movableType)  ||
         (m_blogKind == bloggerAPI)   ||
         (m_blogKind == metaWeblog)   ||
         (m_blogKind == mtAPI)        ||
         (m_blogKind == atomAPI)      ||
         (m_blogKind == newPostOnly)  ||   
         (m_blogKind == typepad)      ||
         (m_blogKind == typepadJapan) ||
         (m_blogKind == cocolog)      ||
         (m_blogKind == cocologFree)  ||
         (m_blogKind == blogzine)     ||
         (m_blogKind == newsHandler)  ||
         (m_blogKind == ameblo)       ||
         (m_blogKind == seesaa)       ||
         (m_blogKind == netLaputa)    ||
         (m_blogKind == blogG)        ||
         (m_blogKind == fc2blog)      ||
         (m_blogKind == gooBlog)      ||
         (m_blogKind == msnSpaces)    ||
         (m_blogKind == drecomX)      ||
         (m_blogKind == yaplogX)      ||
         (m_blogKind == jugemX)       ||
         (m_blogKind == webryX)       ||
         (m_blogKind == livedoor)     ||
         (m_blogKind == lovelog)      ||
         (m_blogKind == sonet)        ||
         (m_blogKind == vox)          ||
         (m_blogKind == hatena)       ||
         (m_blogKind == blogger)         ) {
        if ( m_blogID.GetLength() == 0 ) {
            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
            p->GetWindowText( m_blogID );
            if ( m_blogID.GetLength() == 0 ) {
                MessageBox( "「blog ID」を設定してください    ",
                            "設定確認", MB_OK|MB_ICONWARNING );
                return;
            }
        }

        if ( m_useCbox ) {
            p = (CEdit *)GetDlgItem( IDC_EDIT_ENDPOINTURL );
            p->GetWindowText( m_endpointURL );
        }
        if ( m_endpointURL.GetLength() == 0 ) {
            p = (CEdit *)GetDlgItem( IDC_EDIT_ENDPOINTURL );
            p->GetWindowText( m_endpointURL );
            if ( m_endpointURL.GetLength() == 0 ) {
                MessageBox( "「エンドポイントURL」を設定してください    ",
                            "設定確認", MB_OK|MB_ICONWARNING );
                return;
            }
        }
    }

	CDialog::OnOK();
}
Example #5
0
void PreferencesDialog::setText(int id, char* value)
{
	CEdit* edit = (CEdit*)GetDlgItem(id);
	if (edit)
		edit->SetWindowText(value);
}
//------------------------------------------------------------------------
//! Overrides OnEditBegin() to provide a CEdit cell value editor
//!
//! @param owner The list control starting edit
//! @param nRow The index of the row for the cell to edit
//! @param nCol The index of the column for the cell to edit
//! @return Pointer to the cell editor to use (NULL if cell edit is not possible)
//------------------------------------------------------------------------
CWnd* CGridColumnTraitEdit::OnEditBegin(CGridListCtrlEx& owner, int nRow, int nCol)
{
	// Get position of the cell to edit
	CRect rectCell = GetCellEditRect(owner, nRow, nCol);

	// Get the text-style of the cell to edit
	DWORD dwStyle = m_EditStyle;
	HDITEM hditem = { 0 };
	hditem.mask = HDI_FORMAT;
	VERIFY(owner.GetHeaderCtrl()->GetItem(nCol, &hditem));
	if (hditem.fmt & HDF_CENTER)
		dwStyle |= ES_CENTER;
	else if (hditem.fmt & HDF_RIGHT)
		dwStyle |= ES_RIGHT;
	else
		dwStyle |= ES_LEFT;

	// Create edit control to edit the cell
	CEdit* pEdit = CreateEdit(owner, nRow, nCol, dwStyle, rectCell);
	VERIFY(pEdit != NULL);
	if (pEdit == NULL)
		return NULL;

	// Configure font
	pEdit->SetFont(owner.GetCellFont());

	// First column (Label) doesn't have a margin when imagelist is assigned
	if (nCol == 0 && owner.GetImageList(LVSIL_SMALL) != NULL)
		pEdit->SetMargins(0, 0);
	// First column (Label) doesn't have a margin when checkboxes are enabled
	else if (nCol == 0 && owner.GetExtendedStyle() & LVS_EX_CHECKBOXES)
		pEdit->SetMargins(1, 0);
	// Label column doesn't have margin when not first in column order
	else if (nCol == 0 && owner.GetFirstVisibleColumn() != nCol)
		pEdit->SetMargins(1, 0);
	else if (dwStyle & ES_CENTER)
		pEdit->SetMargins(0, 0);
	else if (dwStyle & ES_RIGHT)
		pEdit->SetMargins(0, 7);
	else
		pEdit->SetMargins(4, 0);

	if (m_EditLimitText != UINT_MAX)
		pEdit->SetLimitText(m_EditLimitText);

	CString cellText = owner.GetItemText(nRow, nCol);
	pEdit->SetWindowText(cellText);
	pEdit->SetSel(0, -1, 0);
	return pEdit;
}
Example #7
0
void    CAddBlogInfoDlg::switchBlogName()
{
    CEdit   *cp = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );

    if ( m_mode )
        m_blogName = "";

    if ( m_useCbox ) {
        m_blogName = "BlogPet 飼育箱";
        cp->SetReadOnly( TRUE );
    }
    else if ( /* (m_blogKind == movableType) || */
                 (m_blogKind == bloggerAPI)  ||
                 (m_blogKind == metaWeblog)  ||
                 (m_blogKind == mtAPI)       ||
                 (m_blogKind == atomAPI)        )
        cp->SetReadOnly( FALSE );
    else if ( (m_blogKind == typepad)      ||
              (m_blogKind == typepadJapan) ||
              (m_blogKind == cocolog)      ||
              (m_blogKind == cocologFree)  ||
              (m_blogKind == blogzine)     ||
              (m_blogKind == newsHandler)  ||
              (m_blogKind == ameblo)       ||
              (m_blogKind == seesaa)       ||
              (m_blogKind == netLaputa)    ||
              (m_blogKind == blogG)        ||
              (m_blogKind == fc2blog)      ||
              (m_blogKind == gooBlog)      ||
              (m_blogKind == msnSpaces)    ||
              (m_blogKind == drecomX)      ||
              (m_blogKind == yaplogX)      ||
              (m_blogKind == jugemX)       ||
              (m_blogKind == webryX)       ||
              (m_blogKind == livedoor)     ||
              (m_blogKind == lovelog)      ||
              (m_blogKind == sonet)        ||
              (m_blogKind == vox)          ||
              (m_blogKind == hatena)       ||
              (m_blogKind == blogger)      ||
              (m_blogKind == tumblr)          ) {
        cp->SetReadOnly( TRUE );
    }
    else if ( m_blogKind == kinugasa ) {
        m_blogName = "キヌガサ";
        cp->SetReadOnly( TRUE );
    }
    else if ( m_blogKind == mixi ) {
        m_blogName = "mixi";
        cp->SetReadOnly( TRUE );
    }
    else if ( m_blogKind == fc2network ) {
        m_blogName = "FC2NETWORK";
        cp->SetReadOnly( TRUE );
    }
    else if ( m_blogKind == colors ) {
        m_blogName = "COLORS";
        cp->SetReadOnly( TRUE );
    }
    else if ( m_blogKind == openPne ) {
        m_blogName = "OpenPNE";
        cp->SetReadOnly( TRUE );
    }
    else
        cp->SetReadOnly( TRUE );

    cp->SetWindowText( m_blogName );
}
Example #8
0
void ExtFrame::AdjustEdit(CSpinButtonCtrl& spin, CEdit& edit, bool two)
{
    int rangeMin;
    int rangeMax;
    spin.GetRange32(rangeMin, rangeMax);
    if(rangeMin <= rangeMax)
    {
        int length = edit.GetWindowTextLength();
        char* temp = new char[length + 1];
        edit.GetWindowText(temp, length + 1);
        int value;
        bool changed = false;
        if(length == 0)
        {
            value = rangeMin;
            changed = true;
        }
        else
        {
            value = atoi(temp);
            if(value < rangeMin)
            {
                value = rangeMin;
                changed = true;
            }
            else if(value > rangeMax)
            {
                value = rangeMax;
                changed = true;
            }
        }
        char numValue[33];
        _itoa_s(value, numValue, 10);
        length = (int)strlen(numValue);

        if(length == 0)
        {
            edit.SetWindowText(two ? "00" : "0");
        }
        else if(two)
        {
            if(length == 1)
            {
                char num[33];
                *num = '0';
                strcpy_s(num + 1, sizeof(num) - 1, numValue);
                edit.SetWindowText(num);
            }
            else if(changed)
            {
                edit.SetWindowText(numValue);
            }
        }
        else
        {
            if(length == 2)
            {
                if(*numValue == '0')
                {
                    edit.SetWindowText(numValue + 1);
                }
                else if(changed)
                {
                    edit.SetWindowText(numValue);
                }
            }
            else if(changed)
            {
                edit.SetWindowText(numValue);
            }
        }
        delete[] temp;
    }
}
void CDlg_SetBatchNumbers::OnAdd() 
{
	CString str, strU;
	UINT nID;

	if (IsDlgButtonChecked (IDC_SETOFNUMBERS) == BST_CHECKED)
	{
		int from, to, step, wc;
		from = GetDlgItemInt (IDC_FROM);
		to = GetDlgItemInt (IDC_TO);
		step = GetDlgItemInt (IDC_STEP);
		wc = GetDlgItemInt (IDC_WB);

		if (to == 0)
		{
			nID = IDC_TO;
			goto _l0Err;
		}

		if (step == 0)
		{
			nID = IDC_STEP;
			goto _l0Err;
		}

		if (wc == 0)
		{
			nID = IDC_WB;
			goto _l0Err;
		}

		if (to <= from)
		{
			MessageBox (LS (L_TOMBGTFROM), LS (L_INPERR), MB_ICONEXCLAMATION);
			((CEdit*) GetDlgItem (IDC_TO))->SetSel (0, -1);
			GetDlgItem (IDC_TO)->SetFocus ();
			return;
		}

		if (false == CheckSetOfNumbersParameters (from, to, step, wc))
			return;

		str.Format ("%d-%d", from, to);
		strU.Format ("%s %d %s %d", LS (L_DLGFROM), from, LS (L_DLGTO), to);
		strU.Remove (':');

		if (step != 1) {
			CString str2; 
			str2.Format ("%c%d", BATCHLIST_STEP_SYMBOL, step);
			str += str2;
			str2.Format (" %s %d", LS (L_DLGSTEP), step);
			str2.Remove (':');
			strU += str2;
		}

		if (wc != 1) {
			CString str2;
			str2.Format ("%c%d", BATCHLIST_WILDCARD_SYMBOL, wc);
			str += str2;
			str2.Format (" %s %d", LS (L_DLGWILDBYTES), wc);
			str2.Remove (':');
			strU += str2;
		}
	}
	else
	{
		int n = GetDlgItemInt (IDC_NUMBER);
		str.Format ("%d", n);
		strU = str;
	}

	m_wndSets.AddString (strU);
	CString *pstr; pstr = new CString;
	*pstr = str;
	m_wndSets.SetItemData (m_wndSets.GetCount () - 1, (DWORD)pstr);
	return;

_l0Err:
	str.Format (LS (L_ENTERGREATER), 0);
	MessageBox (str, LS (L_INPERR), MB_ICONEXCLAMATION);
	CEdit *pE = (CEdit*) GetDlgItem (nID);
	pE->SetSel (0, -1);
	pE->SetFocus ();
}
void CDlgUserConvFormat::OutputFormatString(const wchar_t *sText)
{
	CEdit	*pEdit = m_nOutputFormatType ? &m_editTag2File : &m_editFile2Tag;
	pEdit->ReplaceSel(sText, FALSE);
	pEdit->SetFocus();
}
Example #11
0
void ExtFrame::ScrollEnd(CEdit& edit)
{
    int length = edit.GetWindowTextLength();
    edit.PostMessage(EM_SETSEL, length, length);
}
Example #12
0
static void ClearEditCtrl(CEdit& edit)
{
    edit.SetWindowTextA("");
    AppendTextToEditCtrl(edit, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    edit.SetWindowTextA("");
}
Example #13
0
BOOL 
CCompletionPage::OnSetActive()
{
	WTL::CString strText, strText2;
	SetWizardButtons(PSWIZB_FINISH);

	CStatic ctlStaticResult;
	ctlStaticResult.Attach(GetDlgItem(IDC_BIND_RESULT));

	CEdit ctlEditResult;
	ctlEditResult.Attach(GetDlgItem(IDC_EDIT_BIND_SETTING));

	// add bind type to list
	strText2.LoadString(
		(NMT_AGGREGATE == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_AGGREGATED_DISK :
	(NMT_RAID0 == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_DISK_RAID0 :
	(NMT_RAID1 == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_DISK_RAID1 :
	(NMT_RAID4 == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_DISK_RAID4 : IDS_LOGDEV_TYPE
		);
	strText.FormatMessage(IDS_BNZ_COMPLETE_RESULT_TYPE_FMT, strText2);
	ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));


	// add disk titles to list
	strText.LoadString(IDS_BNZ_COMPLETE_RESULT_DISKS);

	int i;
	NBUnitDevicePtrList::iterator itr;
	CNBUnitDevice *UnitDiskObject, *UnitDiskObjectFailed;
	for(i = 0, itr = m_pWizData->listUnitDevicesBind.begin(); itr != m_pWizData->listUnitDevicesBind.end(); ++itr, i++)
	{
		UnitDiskObject = *itr;
		if(m_pWizData->m_BindResult == i)
			UnitDiskObjectFailed = UnitDiskObject;
		if(itr != m_pWizData->listUnitDevicesBind.begin())
			strText += _T(", "); 

		strText += UnitDiskObject->GetName();
	}
	ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));

	if(m_pWizData->m_BindResult == m_pWizData->m_nDiskCount)
	{
		// success
		strText.LoadString(IDS_BNZ_COMPLETE_SUCCESS);
		ctlStaticResult.SetWindowText(strText);

		// size
		pGetDiskSizeString(strText2, m_pWizData->m_nBindType, m_pWizData->m_nDiskCount, m_pWizData->listUnitDevicesBind);
		strText.FormatMessage(IDS_BNZ_COMPLETE_RESULT_SIZE_FMT, strText2);
		ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
	}
	else
	{
		// fail
		strText.LoadString(IDS_BNZ_COMPLETE_FAIL);
		ctlStaticResult.SetWindowText(strText);

		if(m_pWizData->m_BindResult != 0xFFFFFFFF) // single disk error
		{
			strText.FormatMessage(IDS_BNZ_COMPLETE_RESULT_FAILED_ON_FMT,
				UnitDiskObjectFailed->GetName());
			ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
		}

		GetDescription(strText, m_pWizData->dwBindLastError);
		ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
	}

	return TRUE;
}
Example #14
0
void CCuDlgLogFileAdd::OnBrowse() 
{
	CString strText = _T("");
#if !defined (MAINWIN)
	strText =  _T("C:");
	strText += FILENAME_SEPARATOR;
#endif
	CString strCaption;
	BOOL bOK = FALSE;
	TCHAR tchszBuffer [_MAX_PATH];
	if (strText.GetLength() > _MAX_PATH)
		lstrcpyn (tchszBuffer, strText, _MAX_PATH);
	else
		lstrcpy (tchszBuffer, strText);
	
	LPMALLOC pIMalloc;
	if (!SUCCEEDED(::SHGetMalloc(&pIMalloc)))
	{
		TRACE0("SHGetMalloc failed.\n");
		return;
	}
	//
	// Initialize a BROWSEINFO structure,
	strCaption.LoadString(IDS_CHOOSE_FOLDER);
	BROWSEINFO brInfo;
	::ZeroMemory(&brInfo, sizeof(brInfo));
	brInfo.hwndOwner = m_hWnd;
	brInfo.pidlRoot  = NULL;
	brInfo.pszDisplayName = tchszBuffer;
	brInfo.lpszTitle = (LPCTSTR)strCaption;
	brInfo.lpfn = &mycallback;
	brInfo.lParam = (LPARAM)&brInfo;

	brInfo.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_STATUSTEXT;
	
	//
	// Only want folders (no printers, etc.)
	brInfo.ulFlags |= BIF_RETURNONLYFSDIRS;
	//
	// Display the browser.
	ITEMIDLIST* browseList = NULL;
	browseList = ::SHBrowseForFolder(&brInfo);
	//
	// if the user selected a folder . . .
	if (browseList)
	{
		//
		// Convert the item ID to a pathname,
		if(::SHGetPathFromIDList(browseList, tchszBuffer))
		{
			TRACE1("You chose==>%s\n",tchszBuffer);
			bOK = TRUE;
		}
		//
		// Free the PIDL
		pIMalloc->Free(browseList);
	}
	else
	{
		bOK = FALSE;
	}
	//
	// Cleanup and release the stuff we used
	pIMalloc->Release();
	if (bOK)
	{
		CEdit* pEdit = (CEdit *) GetDlgItem(IDC_LOG_FILENAME);
		if (pEdit)
			pEdit->SetWindowText(tchszBuffer);
	}
}
Example #15
0
void CCardInfDlg::OnTimer(UINT_PTR nIDEvent)
{
	switch (nIDEvent)
	{
	case 1:
	{
		//卡序列号缓冲
		unsigned char myserial[4];
		unsigned char status;
		/*if (!FileExists(FileName))
		{//如果文件不存在
		ShowMessageb("无法在应用程序的文件夹找到IC卡读写卡器动态库");
		return; //返回
		}*/

		typedef unsigned char(__stdcall *ppiccrequest)(unsigned char* serial);
		HINSTANCE hDLL = LoadLibrary(_T("OUR_MIFARE.dll"));// 加载DLL

		ppiccrequest piccrequest;
		piccrequest = (ppiccrequest)GetProcAddress(hDLL, "piccrequest");

		//提取动态库
		//piccrequest = (unsigned char(__stdcall *piccrequest)(unsigned char *serial))GetProcAddress(hDll, "piccread");

		while (true)
		{
			status = piccrequest(myserial);
			//返回值处理
			//调用读卡函数,如果没有寻到卡返回1,拿卡太快返回2,没注册发卡机返回4,没有驱动程序返回3
			switch (status)
			{
			case '0':
			{
				// 获取输入框对象
				CEdit* edit = (CEdit*)GetDlgItem(IDC_phy_number);
				CString ID_str;
				ID_str.Format(_T("%s"), myserial);
				edit->SetWindowTextW(ID_str);
				break;
			}
			case '1':
				//MessageBox(_T("没有寻找到卡!"));
				break;
			case '2':
				//MessageBox(_T("拿卡太快!"));
				break;
			case '3':
				//MessageBox(_T("没有驱动程序!"));
				break;
			case '4':
				//MessageBox(_T("没注册发卡机!"));
				break;
			}
		}
	}
	case 2:
	{
		CString temp;
		temp.Format(_T("%d/%d"), indicator, 20512);
		GetDlgItem(IDC_Search_ID)->SetWindowTextW(temp);
		if (r > 1) KillTimer(2);
		break;
	}
	case 3: {
		CString temp;
		temp.Format(_T("%d/%d"), indicator_ID, 20698);
		GetDlgItem(IDC_getInf)->SetWindowTextW(temp);
		if (r_ID > 1) KillTimer(3);
		break;
	}
	default:
		break;
	}


	CDialogEx::OnTimer(nIDEvent);
}
void CProcessingOptions::OnClickedRadioEntireImage()
{
	CEdit * ctrlEditCoverage = reinterpret_cast<CEdit *> (GetDlgItem(IDC_PERCENT_COVERAGE));
	ctrlEditCoverage->EnableWindow(FALSE);
}
Example #17
0
bool CStudio::EventProcess(const Event &event)
{
    CWindow*    pw;
    CEdit*      edit;
    CSlider*    slider;

    if ( m_dialog != SD_NULL )  // dialogue exists?
    {
        return EventDialog(event);
    }

    if ( event.type == EVENT_FRAME )
    {
        EventFrame(event);
    }

    pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
    if ( pw == nullptr )  return false;

    edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT));
    if ( edit == nullptr )  return false;

    if ( event.type == pw->GetEventTypeClose() )
    {
        Event newEvent = event;
        newEvent.type = EVENT_STUDIO_OK;
        m_event->AddEvent(newEvent);
    }

    if ( event.type == EVENT_STUDIO_EDIT )  // text modifief?
    {
        ColorizeScript(edit);
    }

    if ( event.type == EVENT_STUDIO_LIST )  // list clicked?
    {
        m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
    }

    if ( event.type == EVENT_STUDIO_NEW )  // new?
    {
        m_script->New(edit, "");
    }

    if ( event.type == EVENT_STUDIO_OPEN )  // open?
    {
        StartDialog(SD_OPEN);
    }
    if ( event.type == EVENT_STUDIO_SAVE )  // save?
    {
        StartDialog(SD_SAVE);
    }

    if ( event.type == EVENT_STUDIO_UNDO )  // undo?
    {
        edit->Undo();
    }
    if ( event.type == EVENT_STUDIO_CUT )  // cut?
    {
        edit->Cut();
    }
    if ( event.type == EVENT_STUDIO_COPY )  // copy?
    {
        edit->Copy();
    }
    if ( event.type == EVENT_STUDIO_PASTE )  // paste?
    {
        edit->Paste();
    }

    if ( event.type == EVENT_STUDIO_SIZE )  // size?
    {
        slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE));
        if ( slider == nullptr )  return false;
        m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f);
        ViewEditScript();
    }

    if ( event.type == EVENT_STUDIO_TOOL &&  // instructions?
            m_dialog == SD_NULL )
    {
        m_main->StartDisplayInfo(SATCOM_HUSTON, false);
    }
    if ( event.type == EVENT_STUDIO_HELP &&  // help?
            m_dialog == SD_NULL )
    {
        m_main->StartDisplayInfo(SATCOM_PROG, false);
    }

    if ( event.type == EVENT_STUDIO_COMPILE )  // compile?
    {
        if ( m_script->GetScript(edit) )  // compile
        {
            std::string res;
            GetResource(RES_TEXT, RT_STUDIO_COMPOK, res);
            SetInfoText(res, false);
        }
        else
        {
            std::string error;
            m_script->GetError(error);
            SetInfoText(error, false);
        }
    }

    if ( event.type == EVENT_STUDIO_RUN )  // run/stop?
    {
        if ( m_script->IsRunning() )
        {
            Event newEvent = event;
            newEvent.type = EVENT_OBJECT_PROGSTOP;
            m_event->AddEvent(newEvent);  // stop
        }
        else
        {
            if ( m_script->GetScript(edit) )  // compile
            {
                SetInfoText("", false);

                Event newEvent = event;
                newEvent.type = EVENT_OBJECT_PROGSTART;
                m_event->AddEvent(newEvent);  // start
            }
            else
            {
                std::string error;
                m_script->GetError(error);
                SetInfoText(error, false);
            }
        }
    }

    if ( event.type == EVENT_STUDIO_REALTIME )  // real time?
    {
        m_bRealTime = !m_bRealTime;
        m_script->SetStepMode(!m_bRealTime);
        UpdateFlux();
        UpdateButtons();
    }

    if ( event.type == EVENT_STUDIO_STEP )  // step?
    {
        m_script->Step(event);
    }

    if ( event.type == EVENT_KEY_DOWN )
    {
        if (  event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).primary ||
                event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).secondary )
        {
            if ( m_helpFilename.length() > 0 )
            {
                m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
            }
        }
    }

    if ( event.type == EVENT_WINDOW3 )  // window is moved?
    {
        m_editActualPos = m_editFinalPos = pw->GetPos();
        m_editActualDim = m_editFinalDim = pw->GetDim();
        m_main->SetWindowPos(m_editActualPos);
        m_main->SetWindowDim(m_editActualDim);
        AdjustEditScript();
    }
    if ( event.type == pw->GetEventTypeReduce() )
    {
        if ( m_bEditMinimized )
        {
            m_editFinalPos = m_main->GetWindowPos();
            m_editFinalDim = m_main->GetWindowDim();
            m_bEditMinimized = false;
            m_bEditMaximized = false;
        }
        else
        {
            m_editFinalPos.x =  0.00f;
            m_editFinalPos.y = -0.44f;
            m_editFinalDim.x =  1.00f;
            m_editFinalDim.y =  0.50f;
            m_bEditMinimized = true;
            m_bEditMaximized = false;
        }
        m_main->SetEditFull(m_bEditMaximized);
        pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
        if ( pw != nullptr )
        {
            pw->SetMaximized(m_bEditMaximized);
            pw->SetMinimized(m_bEditMinimized);
        }
    }
    if ( event.type == pw->GetEventTypeFull() )
    {
        if ( m_bEditMaximized )
        {
            m_editFinalPos = m_main->GetWindowPos();
            m_editFinalDim = m_main->GetWindowDim();
            m_bEditMinimized = false;
            m_bEditMaximized = false;
        }
        else
        {
            m_editFinalPos.x = 0.00f;
            m_editFinalPos.y = 0.00f;
            m_editFinalDim.x = 1.00f;
            m_editFinalDim.y = 1.00f;
            m_bEditMinimized = false;
            m_bEditMaximized = true;
        }
        m_main->SetEditFull(m_bEditMaximized);
        pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
        if ( pw != nullptr )
        {
            pw->SetMaximized(m_bEditMaximized);
            pw->SetMinimized(m_bEditMinimized);
        }
    }

    return true;
}
void CProcessingOptions::OnClickedRadioLikelihood()
{
	CEdit * ctrlEditCoverage = reinterpret_cast<CEdit *> (GetDlgItem(IDC_PERCENT_COVERAGE));
	ctrlEditCoverage->EnableWindow(TRUE);
}
LRESULT 
CNdasDevicePropGeneralPage::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
	ATLASSERT(m_pDevice != 0);

	m_hCursor = AtlLoadSysCursor(IDC_ARROW);

	m_wndDeviceName.Attach(GetDlgItem(IDC_DEVICE_NAME));
	m_wndDeviceId.Attach(GetDlgItem(IDC_DEVICE_ID));
	m_wndDeviceStatus.Attach(GetDlgItem(IDC_DEVICE_STATUS));
	m_wndDeviceWriteKey.Attach(GetDlgItem(IDC_DEVICE_WRITE_KEY));
	m_wndAddRemoveWriteKey.Attach(GetDlgItem(IDC_ADD_WRITE_KEY));

	m_wndUnitDeviceGroup.Attach(GetDlgItem(IDC_UNITDEVICE_GROUP));
	m_wndUnitDeviceIcon.Attach(GetDlgItem(IDC_UNITDEVICE_TYPE_ICON));
	m_wndUnitDeviceType.Attach(GetDlgItem(IDC_UNITDEVICE_TYPE));
	m_wndUnitDeviceStatus.Attach(GetDlgItem(IDC_UNITDEVICE_STATUS));
	m_wndUnitDeviceCapacity.Attach(GetDlgItem(IDC_UNITDEVICE_CAPACITY));
	m_wndUnitDeviceROHosts.Attach(GetDlgItem(IDC_UNITDEVICE_RO_HOSTS));
	m_wndUnitDeviceRWHosts.Attach(GetDlgItem(IDC_UNITDEVICE_RW_HOSTS));
	m_wndLogDeviceTree.Attach(GetDlgItem(IDC_LOGDEV_TREE));

	m_wndUnitDeviceList = GetDlgItem(IDC_UNITDEVICE_LIST);

	// Temporary edit control to get an effective password character
	{
		CEdit wndPassword;
		wndPassword.Create(m_hWnd, NULL, NULL, WS_CHILD | ES_PASSWORD);
		m_chConcealed = wndPassword.GetPasswordChar();
		wndPassword.DestroyWindow();
	}

	BOOL fSuccess = m_imageList.CreateFromImage(
		IDB_UNITDEVICES, 
		32, 
		1, 
		CLR_DEFAULT, 
		IMAGE_BITMAP,
		LR_CREATEDIBSECTION | LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
	ATLASSERT(fSuccess && "Loading IDB_UNITDEVICES failed");

	_GrabUnitDeviceControls();

	// get the bold font
	CFontHandle boldFont;
	{
		CFontHandle dlgFont = GetFont();
		LOGFONT logFont;
		dlgFont.GetLogFont(&logFont);
		logFont.lfWeight = FW_BOLD;
		ATLVERIFY(boldFont.CreateFontIndirect(&logFont));
	}

	m_wndUnitDeviceType.SetFont(boldFont);

	// Cover up control, be sure to create this after FillUnitDeviceControls()
	{
		CRect rect;
		m_wndUnitDeviceGroup.GetClientRect(&rect);
		::MapWindowPoints(m_wndUnitDeviceGroup, HWND_DESKTOP, reinterpret_cast<LPPOINT>(&rect), 2);
		::MapWindowPoints(HWND_DESKTOP, m_hWnd, reinterpret_cast<LPPOINT>(&rect), 2);
		rect.DeflateRect(10,50,10,10);
		m_wndNA.Create(m_hWnd, rect, NULL, WS_CHILD | SS_CENTER);
		CString str = MAKEINTRESOURCE(IDS_UNITDEVICE_NONE);
		ATLTRACE("NA: %ws\n", str);
		m_wndNA.SetWindowText(str);
		m_wndNA.SetFont(GetFont());
		m_wndNA.EnableWindow(FALSE);
	}
	{
		CRect rect;
		m_wndLogDeviceTree.GetWindowRect(&rect);
		::MapWindowPoints(HWND_DESKTOP, m_hWnd, reinterpret_cast<LPPOINT>(&rect), 2);
		// rect.DeflateRect(10,10,10,10);
		CString str = MAKEINTRESOURCE(IDS_LOGDEV_INFO_UNAVAILABLE);
		m_wndLogDeviceNA.Create(m_hWnd, rect, str, 
			WS_CHILD | WS_DISABLED | 
			BS_FLAT | BS_CENTER | BS_VCENTER | BS_TEXT);
		// m_wndLogDeviceNA.Create( Create(m_hWnd, rect, NULL, WS_CHILD | SS_CENTER, WS_EX_TRANSPARENT);
		ATLTRACE(_T("LogDevice N/A: %s"), str);
		// m_wndLogDeviceNA.SetWindowText(str);
		m_wndLogDeviceNA.SetFont(GetFont());
		m_wndLogDeviceNA.EnableWindow(FALSE);
	}

	_InitData();

	// Support F5 to refresh
	ACCEL accel = {0};
	accel.fVirt = FVIRTKEY;
	accel.key = VK_F5;
	accel.cmd = IDC_REFRESH_HOST;

	m_hAccel = ::CreateAcceleratorTable(&accel, 1);
	ATLASSERT(NULL != m_hAccel);

	return 0;
}
Example #20
0
/*******************************************************************************
 Function Name  : pomEditItem
 Inputs         : nRow      - Index of the Row
                  nColumn   - Index of the Column
 Output         : CEdit * - Pointer to the control
 Description    : This function will create and show a editbox.
 Member of      : CFlexListCtrl
 Author(s)      : Raja N
 Date Created   : 22.07.2004
 Modifications  :
*******************************************************************************/
CEdit* CFlexListCtrl::pomEditItem(int nItem, int nSubItem)
{
    // Item rect and Client rect
    CRect omRect, omClientRect;

    // Set the item to be visible
    if(!EnsureVisible(nItem, TRUE))
    {
        return NULL;
    }

    // Get the item rect
    GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, omRect);
    // Now scroll if we need to expose the column
    GetClientRect(omClientRect);

    if( omRect.left < 0 || omRect.left > omClientRect.right )
    {
        CSize size(omRect.left,0);
        Scroll(size);
        omRect.left -= size.cx;
    }

    omRect.right = omRect.left + GetColumnWidth(nSubItem);

    // If the size is bigger then the client size then resizes
    if(omRect.right > omClientRect.right)
    {
        omRect.right = omClientRect.right;
    }

    // Get Column alignment
    LV_COLUMN lvcol;
    lvcol.mask = LVCF_FMT;
    GetColumn(nSubItem, &lvcol);
    DWORD dwStyle;

    // Get the justification style of the list item
    if((lvcol.fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
    {
        dwStyle = ES_LEFT;
    }
    else if((lvcol.fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT)
    {
        dwStyle = ES_RIGHT;
    }
    else
    {
        dwStyle = ES_CENTER;
    }

    // Include standard styles
    dwStyle |=WS_BORDER|WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;
    // Get the item text
    CString omStrText = GetItemText(nItem, nSubItem);
    // Create the control now
    CEdit* pomEdit = NULL;
    pomEdit = new CEditItem(nItem, nSubItem, omStrText);

    if( pomEdit != NULL )
    {
        pomEdit->Create(dwStyle, omRect, this, IDC_CONTROL);
    }
    else
    {
        CString omStrErr;
        omStrErr.Format( defFLC_CREATE_FAILED, defEDIT_ITEM );
        AfxMessageBox( omStrErr );
    }

    // Retrun the window pointer
    return pomEdit;
}
Example #21
0
void CAddBlogInfoDlg::OnButtonMoreInfo() 
{
	// 追加情報取得
    CEdit   *p;

#define MAX_BLOGS       30  /* 同一システム内最大設置可能blog数 */

    if ( (m_blogKind == movableType) ||
         (m_blogKind == metaWeblog)  ||
         (m_blogKind == mtAPI)       ||
         (m_blogKind == atomAPI)        ) {
        // エンドポイントURLの自動取得を試みる
        //  -- トップページ URL を取得
        char    topPageURL[MAX_URLLENGTH + 1];
        CEndPointDlg    dialog;
        int res = dialog.DoModal();
        if ( (res == IDOK) && (dialog.m_endPointURL.GetLength() > 0) ) {
            strcpy( topPageURL, (const char *)dialog.m_endPointURL );
            m_blogURL = topPageURL;
            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGURL );
            p->SetWindowText( m_blogURL );

            // -- エンドポイントURL と blog ID を取得
            char    id[MAX_BLOGIDLENGTH + 1];
            char    *url = NULL;

            memset( id, 0x00, MAX_BLOGIDLENGTH + 1 );
            if ( m_blogKind == atomAPI ) {
                CWaitCursor cur;    // マウスカーソルを砂時計表示
                url = getEndpointURLbyAutoDiscoveryOnAtomAPI(
                                                     topPageURL, id );
            }
            else {
                CWaitCursor cur;    // マウスカーソルを砂時計表示
                url = getEndpointURLbyAutoDiscovery( topPageURL, id );
            }

            if ( url && *url ) {
                MessageBox( "エンドポイントURLの取得に成功しました。    ",
                            "取得成功", MB_OK|MB_ICONINFORMATION );
                m_endpointURL = url;
                p = (CEdit *)GetDlgItem( IDC_EDIT_ENDPOINTURL );
                p->SetWindowText( m_endpointURL );

                if ( id[0] ) {
                    p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
                    m_blogID = id;
                    p->SetWindowText( m_blogID );

                    // -- blog名の取得
                    BLOGINF blogInfo[MAX_BLOGS];
                    int     numOfBlogs = MAX_BLOGS;
                    int     r;

                    setTargetURL( m_endpointURL );
                    if ( m_blogKind == atomAPI ) {
                        //  --- Atom API 系の場合
                        CWaitCursor cur;    // マウスカーソルを砂時計表示
                        r = getBlogIDsOnAtomAPI( m_blogUserName, m_blogPassword,
                                                 &numOfBlogs, blogInfo );
                    }
                    else {
                        //  --- blogger API 系の場合
                        CWaitCursor cur;    // マウスカーソルを砂時計表示
                        r = getBlogIDs( m_blogUserName, m_blogPassword,
                                        &numOfBlogs, blogInfo );    /* blogger API */
                    }

                    if ( r == 1 ) {
                        MessageBox( "blog名の取得に成功しました。    ",
                                    "取得成功", MB_OK|MB_ICONINFORMATION );
                        m_blogName = utf2sjis( blogInfo[0].blogName );  /* 確定 */
                        p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
                        p->SetWindowText( (const char *)m_blogName );
                    }
                    else if ( r > 1 ) {
                        for ( int i = 0; i < r; i++ ) {
                            if ( !strcmp( (const char *)m_blogID, blogInfo[i].blogID ) ) {
                                MessageBox( "blog名の取得に成功しました。    ",
                                            "取得成功", MB_OK|MB_ICONINFORMATION );
                                m_blogName = utf2sjis( blogInfo[i].blogName );  /* 確定 */
                                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
                                p->SetWindowText( (const char *)m_blogName );
                                break;
                            }
                        }
                    }
                    else {
                        MessageBox( "blog名の取得に失敗しました。\n\n"
                                    "ユーザ名、パスワードが正しいか確認してください。    ",
                                    "設定確認", MB_OK|MB_ICONWARNING );
                    }
                }
            }
            else
                MessageBox( "エンドポイントURLの取得に失敗しました。\n\n"
                            "ユーザ名、パスワードが正しいか確認してください。    ",
                            "設定確認", MB_OK|MB_ICONWARNING );
        }
    }
    else if ( (m_blogKind == bloggerAPI)   ||
              (m_blogKind == typepad)      ||
              (m_blogKind == typepadJapan) ||
              (m_blogKind == cocolog)      ||
              (m_blogKind == cocologFree)  ||
              (m_blogKind == blogzine)     ||
              (m_blogKind == newsHandler)  ||
              (m_blogKind == ameblo)       ||
              (m_blogKind == seesaa)       ||
              (m_blogKind == netLaputa)    ||
              (m_blogKind == blogG)        ||
              (m_blogKind == fc2blog)      ||
              (m_blogKind == gooBlog)      ||
              (m_blogKind == msnSpaces)    ||
              (m_blogKind == drecomX)      ||
              (m_blogKind == yaplogX)      ||
              (m_blogKind == jugemX)       ||
              (m_blogKind == webryX)       ||
              (m_blogKind == livedoor)     ||
              (m_blogKind == lovelog)      ||
              (m_blogKind == sonet)        ||
              (m_blogKind == vox)          ||
              (m_blogKind == hatena)       ||
              (m_blogKind == blogger)         ) {
        // blog ID の自動取得を試みる
        //  -- 複数の blog が存在する場合は一覧表示し、
        //     ユーザに選択してもらう

        if ( m_blogPassword.GetLength() <= 0 ) {
            // blog ID の取得にはパスワード必須
            MessageBox( "blog ID の自動取得を試みます。\n"
                        "blog ID の自動取得には、「blog にloginする"
                        "ときのパスワード」が必要です。    \n"
                        "blog にloginするときのパスワードを設定して"
                        "ください。",
                        "設定確認", MB_OK|MB_ICONWARNING );
            return;
        }

        BLOGINF blogInfo[MAX_BLOGS];
        int     numOfBlogs = MAX_BLOGS;
        int     r;

        /* --- 投稿可能な blog 一覧の取得 */
        if ( m_blogKind == jugemX ) {
            if ( m_blogUserName.GetLength() > 0 ) {
                char        url[MAX_URLLENGTH];
                const char  *q = strchr( m_endpointURL, '$' );

                if ( q )
                    q++;
                else
                    q = ".jugem.jp/admin/xmlrpc.php";
                sprintf( url, "http://%s%s",
                         (const char *)m_blogUserName,
                         q );

                m_endpointURL = url;
                p = (CEdit *)GetDlgItem( IDC_EDIT_ENDPOINTURL );
                p->SetWindowText( m_endpointURL );
            }
        }
        if ( m_blogKind == hatena ) {
            if ( strstr( m_endpointURL, "{hatenaID}" ) ) {
                m_endpointURL =
                    "http://d.hatena.ne.jp/" + m_blogUserName + "/atom/blog";
                p = (CEdit *)GetDlgItem( IDC_EDIT_ENDPOINTURL );
                p->SetWindowText( m_endpointURL );
            }
        }

        blogInfo[0].blogName[0] = NUL;
        setTargetURL( m_endpointURL );
        if ( (m_blogKind == livedoor) ||
             (m_blogKind == lovelog)  ||
             (m_blogKind == sonet)    ||
             (m_blogKind == ameblo)   ||
             (m_blogKind == vox)      ||
             (m_blogKind == hatena)   ||
             (m_blogKind == blogger)     ) {
            //  --- Atom API 系の場合
            CWaitCursor cur;    // マウスカーソルを砂時計表示
            r = getBlogIDsOnAtomAPI( m_blogUserName, m_blogPassword,
                                     &numOfBlogs, blogInfo );
                    /* 備考: 本家の blogger.com に対しては blogger API */
                    /*       ではなく Atom API を適用する              */
        }
        else {
            //  --- blogger API 系の場合
            CWaitCursor cur;    // マウスカーソルを砂時計表示
            r = getBlogIDs( m_blogUserName, m_blogPassword,
                            &numOfBlogs, blogInfo );    /* blogger API */
        }
        if ( (r >= 1) && (blogInfo[0].blogName[0] == NUL) ) {
            /* FC2BLOG のように取得に失敗しても r == 1 となる blog 対策 */
            MessageBox( "blog ID の取得に失敗しました。\n"
                        "ユーザ名、パスワードが正しいか確認してください。    ",
                        "取得失敗", MB_OK|MB_ICONWARNING );
        }
        else if ( r == 1 ) {
            MessageBox( "blog ID の取得に成功しました。    ",
                        "取得成功", MB_OK|MB_ICONINFORMATION );
            m_blogName = utf2sjis( blogInfo[0].blogName );  /* 確定 */
            m_blogID   = blogInfo[0].blogID;                /* 確定 */
            m_blogURL  = blogInfo[0].url;                   /* 確定 */

            if ( m_blogID == "" )
                if ( (m_blogKind == msnSpaces) ||
                     (m_blogKind == webryX)       )
                    m_blogID = "MyBlog";

            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
            p->SetWindowText( (const char *)m_blogName );

            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
            p->SetWindowText( (const char *)m_blogID );

            if ( !strncmp( m_blogURL, m_endpointURL, strlen(m_endpointURL) ) ) {
                if ( m_blogKind == livedoor )
                    m_blogURL = "http://blog.livedoor.jp/" + m_blogUserName + "/";
                if ( m_blogKind == lovelog )
                    m_blogURL = "http://blog.dion.ne.jp/" + m_blogUserName + "/";
                if ( m_blogKind == ameblo )
                    m_blogURL = "http://ameblo.jp/" + m_blogUserName + "/";
                if ( m_blogKind == sonet )
                    m_blogURL = "http://blog.so-net.ne.jp/" + m_blogUserName + "/";
            }
            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGURL );
            p->SetWindowText( m_blogURL );
        }
        else if ( r > 1 ) {
            /* ---- 投稿先 blog の選択 */
            int rr = selectBlog( blogInfo, r );
            if ( (rr >= 0) && (rr < r) ) {
                r = rr;
                m_blogName = utf2sjis( blogInfo[r].blogName );  /* 確定 */
                m_blogID   = blogInfo[r].blogID;                /* 確定 */
                m_blogURL  = blogInfo[r].url;                   /* 確定 */

                if ( m_blogID == "" )
                    if ( (m_blogKind == msnSpaces) ||
                         (m_blogKind == webryX)       )
                        m_blogID = "MyBlog";

                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
                p->SetWindowText( (const char *)m_blogName );

                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
                p->SetWindowText( (const char *)m_blogID );

                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGURL );
                p->SetWindowText( m_blogURL );

                MessageBox( "blog ID の取得に成功しました。    ",
                            "取得成功", MB_OK|MB_ICONINFORMATION );
            }
        }
        else {
            MessageBox( "blog ID の取得に失敗しました。\n"
                        "ユーザ名、パスワードが正しいか確認してください。    ",
                        "取得失敗", MB_OK|MB_ICONWARNING );
        }
    }
    else if ( m_blogKind == newPostOnly ) {
        m_blogID = "0";
        p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
        p->SetWindowText( (const char *)m_blogID );
    }
    else if ( (m_blogKind == exciteBlog) ||
              (m_blogKind == echoo)      ||
              (m_blogKind == rakuten)    ||
              (m_blogKind == tumblr)        ) {
        BLOGINF blogInfo[MAX_BLOGS];
        int     numOfBlogs = MAX_BLOGS;
        int     r = 0;

        CWaitCursor cur;    // マウスカーソルを砂時計表示

        switch ( m_blogKind ) {
        case exciteBlog:
            r = getBlogIDsExciteBlog( m_blogUserName, m_blogPassword,
                                      &numOfBlogs, blogInfo );
            break;

        case echoo:
            r = getBlogIDsEchoo( m_blogUserName, m_blogPassword,
                                 &numOfBlogs, blogInfo );
            break;

        case rakuten:
            r = getBlogIDsRakuten( m_blogUserName, m_blogPassword,
                                   &numOfBlogs, blogInfo );
            break;

        case tumblr:
            r = getBlogIDsTumblr( m_blogUserName, m_blogPassword,
                                  &numOfBlogs, blogInfo );
            break;
        }

        if ( r > 1 ) {
            /* ---- 投稿先 blog の選択 */
            int rr = selectBlog( blogInfo, r );
            if ( (rr >= 0) && (rr < r) ) {
                r = rr;
                m_blogName = blogInfo[r].blogName;  /* 確定 */
                m_blogID   = blogInfo[r].blogID;    /* 確定 */
                m_blogURL  = blogInfo[r].url;       /* 確定 */

                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
                p->SetWindowText( (const char *)m_blogName );

                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
                p->SetWindowText( (const char *)m_blogID );

                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGURL );
                p->SetWindowText( m_blogURL );

                MessageBox( "blog ID の取得に成功しました。    ",
                            "取得成功", MB_OK|MB_ICONINFORMATION );
            }
        }
        else if ( r == 1 ) {
            MessageBox( "blog URL の取得に成功しました。    ",
                        "取得成功", MB_OK|MB_ICONINFORMATION );

            m_blogURL  = blogInfo[0].url;
            m_blogName = blogInfo[0].blogName;

            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGNAME );
            p->SetWindowText( (const char *)m_blogName );

            p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGURL );
            p->SetWindowText( m_blogURL );

            if ( m_blogKind == exciteBlog ) {
                m_blogID = blogInfo[0].blogID;
                p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGID );
                p->SetWindowText( m_blogID );
            }
        }
        else if ( r <= 0 ) {
            MessageBox("blog URL の取得に失敗しました。"
                       "ユーザ名、パスワードが正しいか確認してください。    ",
                       "取得失敗", MB_OK|MB_ICONWARNING );
        }
    }
}
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
	// Translate dialog
	SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
	SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
	SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
	SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
	SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
	SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
	SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
	SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
	SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_CONN, CTSTRING(FAVORITE_HUB_CONNECTION));
	SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
	SetDlgItemText(IDC_FAV_NO_PM, CTSTRING(FAV_NO_PM));
	SetDlgItemText(IDC_SHOW_JOIN, CTSTRING(FAV_SHOW_JOIN));
	SetDlgItemText(IDC_HIDE_SHARE, CTSTRING(HIDE_SHARE));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
	SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_CHAT_NOTIFY, CTSTRING(CHAT_NOTIFY));
	SetDlgItemText(IDC_FAILOVER, CTSTRING(ACCEPT_FAILOVERS_FAV));
	SetDlgItemText(IDC_AWAY_MSG_LBL, CTSTRING(CUSTOM_AWAY_MESSAGE));

	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_HUBSETTINGS, CTSTRING(GLOBAL_SETTING_OVERRIDES));
	SetDlgItemText(IDC_SEARCH_INTERVAL_DEFAULT, CTSTRING(USE_DEFAULT));

	SetDlgItemText(IDC_FAV_SHAREPROFILE_CAPTION, CTSTRING(SHARE_PROFILE));
	SetDlgItemText(IDC_EDIT_PROFILES, CTSTRING(EDIT_PROFILES));
	SetDlgItemText(IDC_PROFILES_NOTE, CTSTRING(PROFILES_NOTE));

	// Fill in values
	SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
	SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
	SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServerStr()).c_str());
	SetDlgItemText(IDC_NICK, Text::toT(entry->get(HubSettings::Nick)).c_str());
	SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
	SetDlgItemText(IDC_USERDESC, Text::toT(entry->get(HubSettings::Description)).c_str());
	SetDlgItemText(IDC_EMAIL, Text::toT(entry->get(HubSettings::Email)).c_str());

	SetDlgItemText(IDC_AWAY_MSG, Text::toT(entry->get(HubSettings::AwayMsg)).c_str());

	CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton(IDC_SHOW_JOIN, toInt(entry->get(HubSettings::ShowJoins)));
	CheckDlgButton(IDC_SHOW_JOIN_FAV, toInt(entry->get(HubSettings::FavShowJoins)));
	CheckDlgButton(IDC_LOGMAINCHAT, toInt(entry->get(HubSettings::LogMainChat)));
	CheckDlgButton(IDC_CHAT_NOTIFY, toInt(entry->get(HubSettings::ChatNotify)));
	CheckDlgButton(IDC_FAILOVER, toInt(entry->get(HubSettings::AcceptFailovers)));

	CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);

	auto searchInterval = entry->get(HubSettings::SearchInterval);
	CheckDlgButton(IDC_SEARCH_INTERVAL_DEFAULT, searchInterval == HubSettings::getMinInt() ? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(searchInterval).c_str());

	bool isAdcHub = entry->isAdcHub();

	CComboBox combo;
	combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
	combo.AddString(_T("---"));
	combo.SetCurSel(0);

	const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
	for(const auto& name: favHubGroups | map_keys) {
		int pos = combo.AddString(Text::toT(name).c_str());
		
		if(name == entry->getGroup())
			combo.SetCurSel(pos);
	}

	combo.Detach();

	// TODO: add more encoding into wxWidgets version, this is enough now
	// FIXME: following names are Windows only!
	combo.Attach(GetDlgItem(IDC_ENCODING));
	combo.AddString(_T("System default"));
	combo.AddString(_T("English_United Kingdom.1252"));
	combo.AddString(_T("Czech_Czech Republic.1250"));
	combo.AddString(_T("Russian_Russia.1251"));
	combo.AddString(Text::toT(Text::utf8).c_str());

	ctrlProfile.Attach(GetDlgItem(IDC_FAV_SHAREPROFILE));
	appendProfiles();
	hideShare = entry->getShareProfile() && entry->getShareProfile()->getToken() == SP_HIDDEN;
	CheckDlgButton(IDC_HIDE_SHARE, hideShare ? BST_CHECKED : BST_UNCHECKED);


	if(isAdcHub) {
		combo.SetCurSel(4); // select UTF-8 for ADC hubs
		combo.EnableWindow(false);
		if (hideShare)
			ctrlProfile.EnableWindow(false);
	} else {
		ctrlProfile.EnableWindow(false);
		if(entry->getEncoding().empty()) {
			combo.SetCurSel(0);
		} else {
			combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
		}
	}

	combo.Detach();

	// connection modes
	auto appendCombo = [](CComboBox& combo, int curMode) {
		combo.InsertString(0, CTSTRING(DEFAULT));
		combo.InsertString(1, CTSTRING(DISABLED));
		combo.InsertString(2, CTSTRING(ACTIVE_MODE));
		combo.InsertString(3, CTSTRING(PASSIVE_MODE));

		if(curMode == HubSettings::getMinInt())
			combo.SetCurSel(0);
		else if(curMode == SettingsManager::INCOMING_DISABLED)
			combo.SetCurSel(1);
		else if(curMode == SettingsManager::INCOMING_ACTIVE)
			combo.SetCurSel(2);
		else if(curMode == SettingsManager::INCOMING_PASSIVE)
			combo.SetCurSel(3);
	};

	modeCombo4.Attach(GetDlgItem(IDC_MODE4));
	modeCombo6.Attach(GetDlgItem(IDC_MODE6));

	appendCombo(modeCombo4, entry->get(HubSettings::Connection));
	appendCombo(modeCombo6, entry->get(HubSettings::Connection6));

	//external ips
	SetDlgItemText(IDC_SERVER4, Text::toT(entry->get(HubSettings::UserIp)).c_str());
	SetDlgItemText(IDC_SERVER6, Text::toT(entry->get(HubSettings::UserIp6)).c_str());

	fixControls();

	CEdit tmp;
	tmp.Attach(GetDlgItem(IDC_HUBNAME));
	tmp.SetFocus();
	tmp.SetSel(0,-1);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_NICK));
	tmp.LimitText(35);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_USERDESC));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_EMAIL));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBPASS));
	tmp.SetPasswordChar('*');
	tmp.Detach();
	
	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_FAV_SEARCH_INTERVAL_SPIN));
	updown.SetRange32(5, 9999);
	updown.Detach();

	CenterWindow(GetParent());
	loaded = true;
	return FALSE;
}
Example #23
0
void CDlgPanel::OnBnClickedButtonStart()
{
	if (m_pManager)
	{
		int nType = m_pCmbType->GetCurSel();
		if (nType == 0)
		{
			//采集
			CWnd* pCapWnd = GetDlgVideo();
			BOOL bInCap = m_pManager->IsInCapture();
			if (!bInCap)
			{
				CComboBox* pComboxMediaSource = m_pCmbSourceType;
				CComboBox* pVideoCombo = m_pCmbCamera ;
				CComboBox* pAudioCombo = m_pCmbMic ;
				CEdit* pEdtRtspSource = m_pEdtRtspStream;

				SOURCE_TYPE eType = (SOURCE_TYPE)pComboxMediaSource->GetCurSel();
				int nCamId = 0;
				int nAudioId = 0;
				char szURL[128] = {0,};
				CString strTemp = _T("");

				//视频参数设置
				int nWidth = m_sAVCapParamInfo.nVWidth;
				int nHeight = m_sAVCapParamInfo.nVHeight;
				int nFps = m_sAVCapParamInfo.nFps;
				int nBitrate = m_sAVCapParamInfo.nBitrate;
				char  szDataType[64];
				strcpy_s(szDataType, m_sAVCapParamInfo.strColorFormat )	;
				//音频参数设置
				int nASampleRate = m_sAVCapParamInfo.nASampleRate;
				int nAChannels =m_sAVCapParamInfo.nAChannels;

				if (eType == SOURCE_LOCAL_CAMERA)
				{
					nCamId = pVideoCombo->GetCurSel();
					nAudioId = pAudioCombo->GetCurSel();
					strTemp = _T("本地音视频采集");

				}
				else if ((eType == SOURCE_SCREEN_CAPTURE))
				{
					nCamId = -1;
					nAudioId = pAudioCombo->GetCurSel();
					strTemp = _T("屏幕采集");
					strcpy_s(szDataType , "RGB24");

					int nRet =m_pManager->GetScreenCapSize(nWidth, nHeight);
					if (nRet<1)
					{
						m_pManager->LogErr(_T("屏幕采集获取长宽失败,本地预览失败!"));
						return;
					}
				}
				else
				{
					//Start
					wchar_t wszURL[128] = {0,};
					if (NULL != pEdtRtspSource)
						pEdtRtspSource->GetWindowTextW(wszURL, sizeof(wszURL));
					if (wcslen(wszURL) < 1)		return;

					CString strURL = wszURL;
					CString strRTSP = strURL.Mid(0,4);
					if (strRTSP!=_T("rtsp")&&strRTSP!=_T("RTSP"))
					{
						strURL = _T("rtsp://")+strURL;
					}

					__WCharToMByte(strURL, szURL, sizeof(szURL)/sizeof(szURL[0]));
					strTemp = _T("网络音视频流采集");
				}

				int nRet = m_pManager->StartCapture( eType,  nCamId, nAudioId, pCapWnd->GetSafeHwnd(), szURL, nWidth, nHeight, nFps,nBitrate, szDataType, nASampleRate , nAChannels );
				if (nRet>0)
				{
					strTemp +=_T("成功!"); 
					m_pManager->LogErr(strTemp);
				} 
				else
				{
					strTemp +=_T("失败!"); 
					m_pManager->LogErr(strTemp);
					return;
				}

				//推送
				//获取服务器流地址信息
				ServerURLInfo URLInfo;
				memset(&URLInfo, 0, sizeof(ServerURLInfo));
				if (m_pMainDlg)
				{
					m_pMainDlg->	GetPushServerInfo(&URLInfo);
				}

				bool bPushRtmp = false;
				//流名称格式化
				FormatStreamName(URLInfo.sdpName);
				nRet = m_pManager->StartPush(URLInfo.pushServerAddr, URLInfo.pushServerPort,URLInfo.sdpName, URLInfo.nPushBufferLenth, bPushRtmp);
				CString strMsg = _T("");
				CString strIp;
				CString strName;
				strIp = URLInfo.pushServerAddr;
				strName = URLInfo.sdpName;
				if (nRet>=0)
				{
					strMsg.Format(_T("推送EasyDarwin服务器URL:rtsp://%s:%d/%s 成功!"), strIp , URLInfo.pushServerPort, strName);
					m_pManager->LogErr(strMsg);
					m_btnStart.SetWindowText(TEXT("Stop"));
					if (bPushRtmp)
					{
						strMsg.Format(_T("连接RTMP服务器成功,推送RTMP服务器URL:rtmp://%s:1935/live/%s 成功!"), strIp , strName);
						m_pManager->LogErr(strMsg);
					}
				} 
				else
				{
					strMsg.Format(_T("推送EasyDarwin服务器URL:rtsp://%s:%d/%s 失败!"), strIp, URLInfo.pushServerPort,strName);
					m_pManager->LogErr(strMsg);
					if (bPushRtmp)
					{
						if (nRet == -1)
							strMsg.Format(_T("连接RTMP服务器失败!"), strIp , strName);
						else
							strMsg.Format(_T("推送RTMP服务器URL:rtmp://%s:1935/live/%s 失败!"), strIp , strName);
						m_pManager->LogErr(strMsg);
					}
				}
			}
			else
			{
				m_pManager->LogErr(_T("停止推送!"));
				m_pManager->StopPush();

				m_pManager->StopCapture();
				m_btnStart.SetWindowText(TEXT("Start"));
				m_pManager->LogErr(_T("本地预览停止"));

				pCapWnd->Invalidate();	
			}
		} 
		else //直播
		{
			//RTSP
			CWnd* pPlayWnd = GetDlgVideo();
			BOOL bInPlay = m_pManager->IsInPlaying();
			if (!bInPlay)
			{
				char szIp[128] = {0,};
				wchar_t wszIp[128] = {0,};

				if (NULL != m_pEdtRtspStream)	
					m_pEdtRtspStream->GetWindowTextW(wszIp, sizeof(wszIp));
				if (wcslen(wszIp) < 1)		
					return;
				__WCharToMByte(wszIp, szIp, sizeof(szIp)/sizeof(szIp[0]));

				int nRet = m_pManager->StartPlay(szIp, pPlayWnd->GetSafeHwnd());
				m_btnStart.SetWindowText(TEXT("Stop"));
				CString strMsg = _T("");
				if (nRet>0)
				{
					strMsg.Format(_T("直播预览URL:%s 成功!"), wszIp);
				} 
				else
				{
					strMsg.Format(_T("直播预览URL:%s 失败!"), wszIp);
				}
				m_pManager->LogErr(strMsg);
			}
			else
			{
				m_pManager->StopPlay();
				m_btnStart.SetWindowText(TEXT("Start"));
				pPlayWnd->Invalidate();	
				m_pManager->LogErr(_T("停止直播"));
			}
		}
	}
}
long CMUSHclientDoc::SpellCheckCommand(long StartCol, long EndCol) 
{
  if (!App.m_bSpellCheckOK)
    return -1;

  CEdit * pEdit = NULL;
  CWnd * pWnd = NULL;

  // find command window

  for(POSITION pos = GetFirstViewPosition(); pos != NULL; )
	  {
	  CView* pView = GetNextView(pos);
	  
	  if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
  	  {
		  CSendView* pmyView = (CSendView*)pView;

      // what is the current selection?

      pWnd = pmyView;
      pEdit = & (pmyView->GetEditCtrl());
      break;
      
      }	  // end of being a CSendView
    }   // end of loop through views

  if (pEdit == NULL)
	  return -1;    // couldn't find it

  int nStartChar, 
      nEndChar;

  // get current selection
  pEdit->GetSel (nStartChar, nEndChar); 

  // make wanted selection 1-relative
  if (StartCol > 0)
    StartCol--;

  bool bHaveSelection = EndCol > StartCol &&
                         StartCol >= 0 &&
                         EndCol >= 0;

  // select what the scripter wanted
  if (bHaveSelection)
     pEdit->SetSel (StartCol, EndCol); 

  if (App.m_SpellChecker_Lua)
    {

    lua_settop(App.m_SpellChecker_Lua, 0);   // clear stack

    lua_getglobal (App.m_SpellChecker_Lua, SPELLCHECKFUNCTION);  
    if (!lua_isfunction (App.m_SpellChecker_Lua, -1))
      return true;  // assume ok, what can we do?

    CString strText;
    bool bAll = GetSelection (pEdit, strText);
    
    lua_pushstring (App.m_SpellChecker_Lua, strText);  // string to be checked
    lua_pushboolean (App.m_SpellChecker_Lua, bAll);    // doing all?

    int narg = lua_gettop(App.m_SpellChecker_Lua) - 1;  // all but the function
    int error = CallLuaWithTraceBack (App.m_SpellChecker_Lua, narg, 1);
    
    if (error)
      {
      LuaError (App.m_SpellChecker_Lua, "Run-time error", SPELLCHECKFUNCTION, "Command-line spell-check");
      lua_close (App.m_SpellChecker_Lua);
      App.m_SpellChecker_Lua = NULL;
      App.m_bSpellCheckOK = false;
      return -1;    
      }  

    if (lua_isstring (App.m_SpellChecker_Lua, -1))
      {
      const char * p = lua_tostring (App.m_SpellChecker_Lua, -1);
      if (bAll)
        pEdit->SetSel (0, -1, TRUE);
      pEdit->ReplaceSel (p, true);
      // put original selection back
      pEdit->SetSel (nStartChar, nEndChar); 
      return 1;   // spell checked ok
      }

    // put original selection back
    pEdit->SetSel (nStartChar, nEndChar); 
    return 0;      // they cancelled
    }

  return -1;

} // end of CMUSHclientDoc::SpellCheckCommand
Example #25
0
void CEditBar::OnSetFocus()
{
    CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
    pEdit->SetSel(m_nCurSelStart, m_nCurSelEnd, TRUE);
}
Example #26
0
void CReviewPage::Initialize()
{
    // All we have to do is to remind the user the various options
    // he has choosen.
    // Title
    m_sSummary.Empty();
    CString m_sTmp;
    m_sTmp.Format("You are about to install the TeXLive %s Software.\r\n\r\n", TEXLIVE_VERSION);
    m_sSummary += m_sTmp;

    // Space needed and available
    m_sTmp.Format("You have %d kb available on your disk\r\nand you need %d kb to install the files requested.\r\n\r\n", 
                  g_dwSpaceAvailable, g_dwSpaceNeeded);
    // Folder Name
    m_sSummary += m_sTmp;
    m_sTmp.Format("Menu entries will be stored in a folder named %s\r\n\r\n", g_sFolderName);
    // Directories
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Root        Dir: %s\r\n", (const char *) g_sInstallRootDir);
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Main  Texmf Dir: %s\r\n", (const char *) g_sTexmfMain);
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Local Texmf Dir: %s\r\n", (const char *) g_sTexmfLocal);
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Extra Texmf Dir: %s\r\n", (const char *) g_sTexmfExtra);
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Home  Texmf Dir: %s\r\n", (const char *) g_sTexmfHome);
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Var   Texmf Dir: %s\r\n", (const char *) g_sVarTexmf);
    m_sSummary += m_sTmp;
    m_sTmp.Format("    Var   Fonts Dir: %s\r\n", (const char *) g_sVarTexFonts);
    m_sSummary += m_sTmp;

	
    // Doc and source
    m_sTmp.Format("TeX packages will be installed %s their documentation.\r\n",
                  g_bInstallDocumentation ? "with" : "without");
    m_sSummary += m_sTmp;
    m_sTmp.Format("TeX packages will be installed %s their source files.\r\n",
                  g_bInstallSource ? "with" : "without");
    m_sSummary += m_sTmp;
    m_sTmp.Format("XEmTeX support files will %s be installed.\r\n", g_bInstallXEmTeX ? "" : "not");
    m_sSummary += m_sTmp;
    m_sTmp.Format("\r\n");
    m_sSummary += m_sTmp;

    m_sTmp.Format("\r\nSelected Packages:\r\n");
    m_sSummary += m_sTmp;

    POSITION pos;
    TPM *tpm;
    CString sKey;
    pos = g_vSourceTPM.GetStartPosition();
    while (pos) {
        g_vSourceTPM.GetNextAssoc(pos, sKey, tpm);
        m_sTmp.Format("%s(%ld),\r\n", sKey, tpm->GetSize(false));
        if (tpm->IsSelected()) {
            m_sSummary += m_sTmp;
        }
    }

    UpdateData(FALSE);
	
    CEdit *editSummary = reinterpret_cast<CEdit *>(GetDlgItem(IDC_EDIT_SUMMARY));
    editSummary->SetSel(-1, -1);
}
Example #27
0
BOOL CEditBar::PreTranslateMessage(MSG* pMsg) 
{
    CWnd* pWnd;
    CEdit* pEdit;
	if ( pMsg->message == WM_KEYDOWN ) {
        if ( ((CMainFrame*)AfxGetMainWnd())->GetActiveView()->PreTranslateMessage(pMsg) )
            return TRUE;
        switch ( pMsg->wParam ) {
			case VK_RETURN:
			{
				tokenSetup=0;
	 	        if(GetKeyState(VK_SHIFT)&0x1000)  {tokenSetup = 2;}
	 	        if(GetKeyState(VK_CONTROL)&0x1000){tokenSetup = 1;}
     
	            pWnd = ((CMainFrame*)AfxGetMainWnd())->GetActiveView();
		        if ( pWnd ) 
			        pWnd->PostMessage(WM_USER+100 , 0 , 0 );
	            return TRUE;
			}
        case VK_TAB:
            {
                // Check we are in extending mode 
                pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                if ( m_bExtending ) {
                    // substitute word by new value
                    if ( !m_posCurPos ) 
                        m_posCurPos= m_lstTabWords.GetHeadPosition ();

                    CString strWord = m_lstTabWords.GetNext(m_posCurPos);
                    CString str = m_strStartLine;
                    str += strWord;
                    str+= m_strEndLine;
                    m_bExtendingChange = TRUE;
                    pEdit->SetWindowText (str);
                    pEdit->SetSel (m_strStartLine.GetLength () + strWord.GetLength (), 
                            m_strStartLine.GetLength () + strWord.GetLength ());
                    m_bExtendingChange = FALSE;
                    return TRUE;
                }
                
                // ok, get current line, word etc 
                CString strText;
                pEdit->GetWindowText (strText);

                if ( !strText.GetLength () ) 
                    return TRUE;

                int start, end;
                pEdit->GetSel (start, end);

                if ( end <= 0  || strText[end-1] == ' ') 
                    return TRUE;

                m_strEndLine = strText.Right(strText.GetLength() - end);

                strText = strText.Left(end);

                int cpos = strText.ReverseFind(' ');

                CString strWord;
                if ( cpos < 0 ) {
                    strWord =  strText;
                    m_strStartLine.Empty ();
                } else {
                    strWord = strText.Right(strText.GetLength () - cpos-1);
                    m_strStartLine = strText.Left (cpos +1);
                }
                m_lstTabWords.RemoveAll ();
                // now find all words same as this one 
                CSmcDoc* pDoc = (CSmcDoc*)((CMainFrame*)AfxGetMainWnd())->GetActiveDocument ();
                if ( !pDoc ) 
                    return TRUE;

                m_lstTabWords.AddHead(strWord );
                POSITION pos = pDoc->m_lstTabWords.GetHeadPosition ();
                while ( pos ) {
                    CString str = pDoc->m_lstTabWords.GetNext(pos);
                    if ( !strnicmp(str, strWord, strWord.GetLength()) ) {
                        m_lstTabWords.AddTail (str);
                    }
                }

                if ( m_lstTabWords.GetCount () < 2 ) {
                    m_lstTabWords.RemoveAll ();
                    return TRUE;
                }
                m_bExtending = TRUE;
                m_posCurPos = m_lstTabWords.GetHeadPosition();
                m_lstTabWords.GetNext (m_posCurPos);
                strWord = m_lstTabWords.GetNext (m_posCurPos);
                strText = m_strStartLine + strWord + m_strEndLine;
                m_bExtendingChange = TRUE;
                pEdit ->SetWindowText (strText);
                int selpos = m_strStartLine.GetLength () + strWord.GetLength ();
                pEdit->SetSel (selpos, selpos);
                m_bExtendingChange = FALSE;
                return TRUE;

            }
            break;
        case VK_UP:
            if ( GetKeyState(VK_CONTROL) >= 0 ) {
                PrevLine();
                return TRUE;
            } else 
                return FALSE;
        case VK_DOWN:
            if ( GetKeyState(VK_CONTROL) >= 0 ) {
                NextLine();
                return TRUE;
            } else 
                return FALSE;
        case 'C':
            if ( GetKeyState(VK_CONTROL)&0x1000){
                pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                pEdit->Copy();
                return TRUE;
            }
            break;
		case VK_DELETE:
            if ( GetKeyState(VK_SHIFT)&0x1000){
                pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                pEdit->Cut();
                return TRUE;
            }
            break;
        case 'X':
            if ( GetKeyState(VK_CONTROL)&0x1000){
                pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                pEdit->Cut();
                return TRUE;
            }
            break;
		case VK_INSERT:
            if ( GetKeyState(VK_CONTROL)&0x1000){
                pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                pEdit->Copy();
                return TRUE;
            }
            if ( GetKeyState(VK_SHIFT)&0x1000){
                /*pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                pEdit->Paste();*/
                DoPaste();
                return TRUE;
            }
            break;
        case 'V':
            if ( GetKeyState(VK_CONTROL)&0x1000){
                /*pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
                pEdit->Paste();*/
                DoPaste();
                return TRUE;
            }
            break;
        default:
            break;
        };
    }
	if ( pMsg->message == WM_SYSKEYDOWN ) {
        if ( ((CMainFrame*)AfxGetMainWnd())->GetActiveView()->PreTranslateMessage(pMsg) )
            return TRUE;

    }
    
	return CDialogBar::PreTranslateMessage(pMsg);
}
void CInteractionAreaDialog::ExtractActionParameters(int nAction)
{	
   int nEditId = 0;
   AreaActionTypeId nActionTypeId, nNextActionTypeId;
   switch (nAction)
   {
   case ACTION_ACTIVATION:
      nEditId = IDC_ACTIVATION_DESTINATION;
      nActionTypeId = (AreaActionTypeId)m_wndClickAction.GetItemData(m_wndClickAction.GetCurSel());
	  if(m_cbActivStartReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_START_REPLAY;
	   else if (m_cbActivStopReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_STOP_REPLAY;
	   else
		   nNextActionTypeId = INTERACTION_NO_ACTION;
      break;
   case ACTION_MOUSEDOWN:
      nEditId = IDC_MOUSEDOWN_DESTINATION;
      nActionTypeId = (AreaActionTypeId)m_wndDownAction.GetItemData(m_wndDownAction.GetCurSel());
	   if(m_cbMousedownStartReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_START_REPLAY;
	   else if (m_cbMousedownStopReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_STOP_REPLAY;
	   else
		   nNextActionTypeId = INTERACTION_NO_ACTION;
      break;
   case ACTION_MOUSEUP:
      nEditId = IDC_MOUSEUP_DESTINATION;
      nActionTypeId = (AreaActionTypeId)m_wndUpAction.GetItemData(m_wndUpAction.GetCurSel());
	  if(m_cbMouseupStartReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_START_REPLAY;
	   else if (m_cbMouseupStopReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_STOP_REPLAY;
	   else
		   nNextActionTypeId = INTERACTION_NO_ACTION;
      break;
   case ACTION_MOUSEIN:
      nEditId = IDC_MOUSEIN_DESTINATION;
      nActionTypeId = (AreaActionTypeId)m_wndEnterAction.GetItemData(m_wndEnterAction.GetCurSel());
	  if(m_cbMouseinStartReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_START_REPLAY;
	   else if (m_cbMouseinStopReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_STOP_REPLAY;
	   else
		   nNextActionTypeId = INTERACTION_NO_ACTION;
      break;
   case ACTION_MOUSEOUT:
      nEditId = IDC_MOUSEOUT_DESTINATION;
      nActionTypeId = (AreaActionTypeId)m_wndLeaveAction.GetItemData(m_wndLeaveAction.GetCurSel());
	  if(m_cbMouseoutStartReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_START_REPLAY;
	   else if (m_cbMouseoutStopReplay.GetCheck())
		   nNextActionTypeId = INTERACTION_STOP_REPLAY;
	   else
		   nNextActionTypeId = INTERACTION_NO_ACTION;
      break;
   }
   
   m_nActionTypeId[nAction] = nActionTypeId;
   m_nNextActionTypeId[nAction] = nNextActionTypeId;

   if (nActionTypeId == INTERACTION_OPEN_URL || nActionTypeId == INTERACTION_OPEN_FILE)
	{	
		CEdit *pEdit = (CEdit *)GetDlgItem(nEditId);
		if (pEdit)
			pEdit->GetWindowText(m_csActionPath[nAction]);
	}
}
Example #29
0
// **************************************************************************
// EditSubLabel ()
//
// Description:
//	Edit the subitem value.  Creates a CEdit object sized and placed to cover
//	list control cell.  This edit box is needed to receive user input, and
//	will delete itself when its parent window is destroyed.
//
// Parameters:
//  int			nItem	Index of item
//	int			nCol	Column of item
//
// Returns:
//  CEdit* - Pointer to a CEdit object to be used to edit cell.
// **************************************************************************
CEdit* CKListEditCtrl::EditSubLabel (int nItem, int nCol)
	{
	int cnColumns = 0;
	int nColOffset = 0;

	// Make sure that the item is visible:
	if (!EnsureVisible (nItem, TRUE)) 
		return (NULL);

	// Get the number of columns:
	CHeaderCtrl* pHeader = (CHeaderCtrl*) GetDlgItem (0);
	cnColumns = pHeader->GetItemCount ();

	// Make sure that column is valid:
	if (nCol >= cnColumns || GetColumnWidth (nCol) < 5)
		return (NULL);

	// Get the column offset (from left boundary):
	nColOffset = 0;
	for (int i = 0; i < nCol; i++)
		nColOffset += GetColumnWidth (i);

	// Get selected item's rectangle:
	CRect rect;
	GetItemRect (nItem, &rect, LVIR_BOUNDS);

	// Scroll if we need to expose the column:
	CRect rcClient;
	GetClientRect (&rcClient);
	
	if (nColOffset + rect.left < 0 || nColOffset + rect.left > rcClient.right)
		{
		CSize size;
		size.cx = nColOffset + rect.left;
		size.cy = 0;
		Scroll (size);
		rect.left -= size.cx;
		}

	// Get column alignment:
	LV_COLUMN lvcol;
	lvcol.mask = LVCF_FMT;
	GetColumn (nCol, &lvcol);
	DWORD dwStyle;

	switch (lvcol.fmt & LVCFMT_JUSTIFYMASK)
		{
		case LVCFMT_LEFT:
			dwStyle = ES_LEFT;
			break;

		case LVCFMT_RIGHT:
			dwStyle = ES_RIGHT;
			break;

		default:
			dwStyle = ES_CENTER;
			break;
		}

	rect.left += (nColOffset + 4);
	rect.right = rect.left + GetColumnWidth (nCol) - 10;

	if (rect.right > rcClient.right) 
		rect.right = rcClient.right;

	// Defile edit control (base class) style:
	dwStyle |= WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;

	// Create a new CKListEdit box (not to be confused with CKListEditCtrl):
	CEdit *pEdit = new CKListEdit (nItem, nCol, GetItemText (nItem, nCol));

	// Set style, size and position using base class:
	pEdit->Create (dwStyle, rect, this, IDC_LISTEDIT);

	// Update currently selected item:
	m_nSelItem = nItem;

	// Return pointer to new CKListEdit control:
	return (pEdit);
	}
BOOL CFontTexCreaterDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	g_dllMdl = ::LoadLibraryA( "FTProxy.dll" ) ;

	if( g_dllMdl == INVALID_HANDLE_VALUE )
	{
		printf( "LoadModule FTProxy.dll failed." ) ;
		return - 1 ;
	}


	func_createIns = (FT_CreateInstance)::GetProcAddress( g_dllMdl , "FTProxy_CreateInstance" ) ;
	func_destroyIns =(FT_DestroyInstance)::GetProcAddress( g_dllMdl , "FTProxy_DestroyInstance" ) ;

	func_setCanvas =(FT_SetCanvas)::GetProcAddress( g_dllMdl , "FTProxy_SetCanvas" ) ;
	func_setFont =(FT_SetFont)::GetProcAddress( g_dllMdl , "FTProxy_SetFont" ) ;
	func_setFontInd = (FT_SetFontInd)::GetProcAddress( g_dllMdl , "FTProxy_SetFontInd" ) ;
	func_drawGlyph =(FT_DrawGlyph)::GetProcAddress( g_dllMdl , "FTProxy_DrawGlyph" ) ;
	func_drawGlyphs =(FT_DrawGlyphs)::GetProcAddress( g_dllMdl , "FTProxy_DrawGlyphs" ) ;
	func_setLogFunc =(FT_SetLogFunc)::GetProcAddress( g_dllMdl , "FTProxy_SetLogFunc" ) ;
	func_drawAllGlyphs = (FT_DrawAllGphphs)::GetProcAddress( g_dllMdl , "FTProxy_DrawAllGphphs" ) ;

	func_drawGlyphFromFile = (FT_DrawGlyphsFromFile)::GetProcAddress( g_dllMdl , "FTProxy_DrawGlyphFromFile" ) ;

	func_getCfgCnt = (FT_GetCfgCnt)::GetProcAddress( g_dllMdl , "FTProxy_GetCfgCnt" ) ;
	func_getCfg = (FT_GetCfg)::GetProcAddress( g_dllMdl , "FTProxy_GetCfg" ) ;

	//for( int i = 0 ; i < 5 ; i ++ )
	//	Sleep( 1500 ) ;

	//
	g_nFtIns = func_createIns( "font.cfg" ) ;

	//
	m_pCfgCombo = (CComboBox *)GetDlgItem(IDC_COMBO1) ;
	if( m_pCfgCombo )
	{
		int cfgCnt = func_getCfgCnt( g_nFtIns ) ;

		for( int i = 0 ; i < cfgCnt ; i ++ )
		{
			const char* desc = func_getCfg( g_nFtIns , i ) ;

			wchar_t wBf[512] ;
			memset( wBf , 0 , 512*sizeof(wchar_t) ) ;

			::MultiByteToWideChar( CP_ACP , 0 , desc , strlen(desc) , wBf , 512 ) ;

			m_pCfgCombo->AddString( wBf ) ;
		}
	}

	//
	CEdit* pEdt = (CEdit*)GetDlgItem(IDC_EDT_TEXTURE_W) ;
	pEdt->SetWindowText( _T("1024") ) ;

	pEdt = (CEdit*)GetDlgItem(IDC_EDT_TEXTURE_H) ;
	pEdt->SetWindowText( _T("1024") ) ;

	return TRUE;  // return TRUE  unless you set the focus to a control
}