コード例 #1
0
/***********************************************************
 * Constructor.
 ***********************************************************/
HAddTrackerWindow::HAddTrackerWindow(BRect rect,const char* name)
		:BWindow(rect,name,B_TITLED_WINDOW_LOOK,B_MODAL_APP_WINDOW_FEEL,B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_ASYNCHRONOUS_CONTROLS)
{
	InitGUI();
	BTextControl *control = cast_as(FindView("name"),BTextControl);
	control->MakeFocus(true);
}
コード例 #2
0
ファイル: SeqStudioWindow.cpp プロジェクト: dtbinh/Sequitur
status_t SeqStudioWindow::SetConfiguration(const BMessage* config)
{
	ArpASSERT(config);
	status_t	err = SetDimensions(config, this);
	if (err != B_OK) return err;
	/* Set the columns
	 */
	BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) );
	if (table) {
		BMessage	colMsg;
		for (int32 k = 0; config->FindMessage("column", k, &colMsg) == B_OK; k++) {
			const char*		colName;
			float			colW;
			bool			colVis;
			if (colMsg.FindString("name", &colName) == B_OK
					&& colMsg.FindFloat("width", &colW) == B_OK
					&& colMsg.FindBool("visible", &colVis) == B_OK) {
				BColumn*	col = col_named(colName, table);
				if (col) {
					col->SetWidth(colW);
					col->SetVisible(colVis);
				}
			}
		}
	}
	return B_OK;
}
コード例 #3
0
ファイル: HDialog.cpp プロジェクト: HaikuArchives/Pe
void HDialog::SetOn(const char *name, bool on)
{
	BControl *ctrl;
	ctrl = dynamic_cast<BControl *>(FindView(name));
	if (ctrl)
		ctrl->SetValue(on ? B_CONTROL_ON : B_CONTROL_OFF);
} /* HDialog::SetOn */
コード例 #4
0
void
BMenuField::_InitMenuBar(const BMessage* archive)
{
	bool fixed;
	if (archive->FindBool("be:fixeds", &fixed) == B_OK)
		fFixedSizeMB = fixed;

	fMenuBar = (BMenuBar*)FindView("_mc_mb_");
	if (!fMenuBar) {
		_InitMenuBar(new BMenu(""), BRect(0, 0, 100, 15), fFixedSizeMB);
		InitObject2();
	} else {
		fMenuBar->AddFilter(new _BMCFilter_(this, B_MOUSE_DOWN));
			// this is normally done in InitObject2()
	}

	fMenu = fMenuBar->SubmenuAt(0);

	bool disable;
	if (archive->FindBool("_disable", &disable) == B_OK)
		SetEnabled(!disable);

	bool dmark = false;
	archive->FindBool("be:dmark", &dmark);
	if (_BMCMenuBar_* menuBar = dynamic_cast<_BMCMenuBar_*>(fMenuBar))
		menuBar->TogglePopUpMarker(dmark);
}
コード例 #5
0
CGumpPtr CGumpEditorDoc::GetSelectedGump(void)
{
	CGumpPtr pDib;
	CGumpView* pView = (CGumpView*)FindView(RUNTIME_CLASS(CGumpView));	
	if (pView) pDib = pView->GetGump();
	
	return pDib;
}
コード例 #6
0
ファイル: HDialog.cpp プロジェクト: HaikuArchives/Pe
void HDialog::SetLabel(const char *id, const char *label)
{
	BControl *control = dynamic_cast<BControl*>(FindView(id));
	if (control)
		control->SetLabel(label);
	else
		THROW(("Control '%s' not found", id));
} // HDialog::SetLabel
コード例 #7
0
void PrefWindow::MessageReceived(BMessage *message) {
    BView *tmpV;
    int32 k;

    switch (message->what) {
    case QUIT:
        Hide();
        break;

    case CHANGE_LANGUAGE:
        tmpV = ChildAt(0);
        if (tmpV != NULL) {
            tmpV->RemoveSelf();
            delete tmpV;
        }
        AddChild(new PrefView(Bounds()));
        break;

    case SET_FACTORY:
        k = (new BAlert(NULL,Language.get("FACTORY_SURE"),Language.get("APPLY"),Language.get("CANCEL")))->Go();
        if (k==0) {
            Prefs.FactorySettings();
            KeyBind.InstallDefaults();
            tmpV = FindView("Prefs color");
            if (tmpV != NULL) {
                PostMessage(COLOR_SELECT, tmpV);
            }
            tmpV = FindView("Prefs keys");
            if (tmpV != NULL) {
                tmpV->LockLooper();
                tmpV->Pulse();
                tmpV->UnlockLooper();
            } else {
                be_app->PostMessage(CHANGE_LANGUAGE);
            }
            Pool.sample_view_dirty = true;	// update the sample-view
            Pool.update_draw_cache = true;	// update the draw cache
            Pool.update_index = true;		// update the index cache
            Pool.RedrawWindow();
        }
        break;

    default:
        BWindow::MessageReceived(message);
    }
}
コード例 #8
0
ファイル: HDialog.cpp プロジェクト: HaikuArchives/Pe
const char* HDialog::GetText(const char *name) const
{
	BTextControl *t = dynamic_cast<BTextControl *>(FindView(name));
	if (t)
		return t->Text();
	else
		return NULL;
} /* HDialog::SetText */
コード例 #9
0
//------------------------------------------------------------------------------
void	TPrefsView::GetChildPointers()
{
	// タブ別に取得
		// (コンテナ)
	mTabViewPrefs = dynamic_cast<BTabView*>(FindView(VIEW_NAME_TAB_VIEW_PREFS));
	mTabGeneral = mTabViewPrefs->TabAt(PT_GENERAL);
	mTabHotKey = mTabViewPrefs->TabAt(PT_HOT_KEY);
	mTabAsst = mTabViewPrefs->TabAt(PT_ASST);
		// 全般タブ
	mBoxClipboard = dynamic_cast<BBox*>(mTabGeneral->View()->FindView(VIEW_NAME_BOX_CLIPBOARD));
	mTxtCtrlNumClipboardHistories = dynamic_cast<BTextControl*>(mTabGeneral->View()->FindView(VIEW_NAME_TXT_CTRL_NUM_CLIPBOARD_HISTORIES));
	mCBoxSaveClipboard = dynamic_cast<BCheckBox*>(mTabGeneral->View()->FindView(VIEW_NAME_CBOX_SAVE_CLIPBOARD));
	mCBoxLoseFocus = dynamic_cast<BCheckBox*>(mTabGeneral->View()->FindView(VIEW_NAME_CBOX_LOSE_FOCUS));
	mCBoxMinimizedBoot = dynamic_cast<BCheckBox*>(mTabGeneral->View()->FindView(VIEW_NAME_CBOX_MINIMIZED_BOOT));
	mCBoxLockTemplateOrder = dynamic_cast<BCheckBox*>(mTabGeneral->View()->FindView(VIEW_NAME_CBOX_LOCK_TEMPLATE_ORDER));
		// ホットキータブ
	mBoxActivate = dynamic_cast<BBox*>(mTabHotKey->View()->FindView(VIEW_NAME_BOX_ACTIVATE));
	mCBoxActivateShift = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_ACTIVATE_SHIFT));
	mCBoxActivateCtrl = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_ACTIVATE_CTRL));
	mCBoxActivateAlt = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_ACTIVATE_ALT));
	mTxtCtrlActivateChar = dynamic_cast<BTextControl*>(mTabHotKey->View()->FindView(VIEW_NAME_TXT_CTRL_ACTIVATE_CHAR));
	mBoxDelete = dynamic_cast<BBox*>(mTabHotKey->View()->FindView(VIEW_NAME_BOX_DELETE));
	mCBoxDeleteShift = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_DELETE_SHIFT));
	mCBoxDeleteCtrl = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_DELETE_CTRL));
	mCBoxDeleteAlt = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_DELETE_ALT));
	mTxtCtrlDeleteChar = dynamic_cast<BTextControl*>(mTabHotKey->View()->FindView(VIEW_NAME_TXT_CTRL_DELETE_CHAR));
	mBoxPopUp = dynamic_cast<BBox*>(mTabHotKey->View()->FindView(VIEW_NAME_BOX_POP_UP));
	mCBoxPopUpShift = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_POP_UP_SHIFT));
	mCBoxPopUpCtrl = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_POP_UP_CTRL));
	mCBoxPopUpAlt = dynamic_cast<BCheckBox*>(mTabHotKey->View()->FindView(VIEW_NAME_CBOX_POP_UP_ALT));
	mTxtCtrlPopUpChar = dynamic_cast<BTextControl*>(mTabHotKey->View()->FindView(VIEW_NAME_TXT_CTRL_POP_UP_CHAR));
	mStrViewHintUsingHotKey = dynamic_cast<BStringView*>(mTabHotKey->View()->FindView(VIEW_NAME_STR_VIEW_HINT_USING_HOT_KEY));
		// アシスタントタブ
	mBoxAutoInstallAsst = dynamic_cast<BBox*>(mTabAsst->View()->FindView(VIEW_NAME_BOX_AUTO_INSTALL_ASST));
	mRButtonEnableAutoInstallAsst = dynamic_cast<BRadioButton*>(mTabAsst->View()->FindView(VIEW_NAME_RBUTTON_ENABLE_AUTO_INSTALL_ASST));
	mRButtonDisableAutoInstallAsst = dynamic_cast<BRadioButton*>(mTabAsst->View()->FindView(VIEW_NAME_RBUTTON_DISABLE_AUTO_INSTALL_ASST));
	mButtonInstallAsst = dynamic_cast<BButton*>(mTabAsst->View()->FindView(VIEW_NAME_BUTTON_INSTALL_ASST));
	mButtonUninstallAsst = dynamic_cast<BButton*>(mTabAsst->View()->FindView(VIEW_NAME_BUTTON_UNINSTALL_ASST));
	mStrViewAsstStatus = dynamic_cast<BStringView*>(mTabAsst->View()->FindView(VIEW_NAME_STR_VIEW_ASST_STATUS));
	// ボタン
	mButtonHelp = dynamic_cast<BButton*>(FindView(VIEW_NAME_BUTTON_HELP));
	mButtonDefaults = dynamic_cast<BButton*>(FindView(VIEW_NAME_BUTTON_DEFAULTS));
	mButtonCancel = dynamic_cast<BButton*>(FindView(VIEW_NAME_BUTTON_CANCEL));
	mButtonOK = dynamic_cast<BButton*>(FindView(VIEW_NAME_BUTTON_OK));
}
コード例 #10
0
void
TFilePanel::SetButtonLabel(file_panel_button selector, const char* text)
{
	switch (selector) {
		case B_CANCEL_BUTTON:
			{
				BButton* button
					= dynamic_cast<BButton*>(FindView("cancel button"));
				if (button == NULL)
					break;

				float old_width = button->StringWidth(button->Label());
				button->SetLabel(text);
				float delta = old_width - button->StringWidth(text);
				if (delta) {
					button->MoveBy(delta, 0);
					button->ResizeBy(-delta, 0);
				}
			}
			break;

		case B_DEFAULT_BUTTON:
			{
				fButtonText = text;
				float delta = 0;
				BButton* button
					= dynamic_cast<BButton*>(FindView("default button"));
				if (button != NULL) {
					float old_width = button->StringWidth(button->Label());
					button->SetLabel(text);
					delta = old_width - button->StringWidth(text);
					if (delta) {
						button->MoveBy(delta, 0);
						button->ResizeBy(-delta, 0);
					}
				}

				// now must move cancel button
				button = dynamic_cast<BButton*>(FindView("cancel button"));
				if (button != NULL)
					button->MoveBy(delta, 0);
			}
			break;
	}
}
コード例 #11
0
void TQueueDialog::Init() 
{
	//
	//	Locate all child views
	//
	
	//	Find buttons
	m_StopButton 	= (BButton *)FindView("StopButton");
	m_StartButton 	= (BButton *)FindView("StartButton");
	m_AddButton 	= (BButton *)FindView("AddButton");
	m_RemoveButton	= (BButton *)FindView("RemoveButton");
	
	//	Find and setup list view
	m_TracksListScrollView 	 = (BScrollView *)FindView("TracksListScrollView");
	BListView *tracksListView = (BListView *)FindView("TracksListView");
	BRect frame = tracksListView->Frame();
	frame.InsetBy(2, 2);
	m_TracksListView = new TQueueListView(this, frame);
	tracksListView->Parent()->AddChild(m_TracksListView);
	tracksListView->RemoveSelf();
	delete tracksListView;
	
	//	Set list view messages
	BMessage *selectMessage = new BMessage(QUEUE_LIST_SELECT_MSG);
	m_TracksListView->SetSelectionMessage(selectMessage);
	
	BMessage *invokeMessage = new BMessage(QUEUE_LIST_INVOKE_MSG);
	m_TracksListView->SetInvocationMessage(invokeMessage);
	
	//	Find status bar
	m_EncodeStatusBar = (BStatusBar *)FindView("EncodeStatusBar");
	m_EncodeStatusBar->Reset("Waiting...", "");
	
	UpdateControls();	
}
コード例 #12
0
ファイル: HDialog.cpp プロジェクト: HaikuArchives/Pe
bool HDialog::IsOn(const char *name) const
{
	BControl *ctrl;
	ctrl = dynamic_cast<BControl *>(FindView(name));
	if (ctrl)
		return ctrl->Value() == B_CONTROL_ON;
	else
		return false;
} /* HDialog::IsOn */
コード例 #13
0
ファイル: CInfoDialog.cpp プロジェクト: jscipione/Paladin
void CInfoDialog::Show()
{
	HDialog::Show();
	if (LockLooper())
	{
		HTabSheet* tabBook = (HTabSheet*)FindView("tabbook");
		BRect okFrame = FindView("ok")->Frame();
		if (tabBook) {
			BPoint bottomRight = tabBook->AdjustBottomRightOfAllPanes();
			if (bottomRight.x < okFrame.right)
				bottomRight.x = okFrame.right;
			if (bottomRight.y < okFrame.bottom)
				bottomRight.y = okFrame.bottom;
			ResizeTo(bottomRight.x+5, bottomRight.y+5);
		}
		UnlockLooper();
	}
}
コード例 #14
0
ファイル: SeqStudioWindow.cpp プロジェクト: dtbinh/Sequitur
void SeqStudioWindow::ToggleColumn(const char* name)
{
	BColumnListView*	table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) );
	if (!table) return;
	BColumn*			col = column_named(name, table);
	if (!col) return;
	if (col->IsVisible() ) col->SetVisible(false);
	else col->SetVisible(true);
}
コード例 #15
0
ファイル: CutContaining.cpp プロジェクト: jscipione/Paladin
CCutContainingDialog::CCutContainingDialog(BRect frame, const char *name, window_type type, int flags,
			BWindow *owner, BPositionIO* data)
	: HDialog(frame, name, type, flags, owner, data)
{
	SetOn("sel", sSelectionOnly);
	BView *textView = FindView("text");
	if (textView)
		textView->MakeFocus(true);
} /* CCutContainingDialog::CCutContainingDialog */
コード例 #16
0
ファイル: MainWindow.cpp プロジェクト: HaikuArchives/Slayer
void MainWindow::DoPriority()
{
	BTextControl *PriorityValue = (BTextControl *)FindView("MainPriorityValue");
	if (strcmp("", PriorityValue->Text())) {
		int32 value;
		value = atoi(PriorityValue->Text());
		DoPriority(value);
	}
}
コード例 #17
0
ファイル: TextControl.cpp プロジェクト: Ithamar/cosmoe
void
BTextControl::InitData(const char *label, const char *initial_text,
							BMessage *data)
{
	BRect bounds(Bounds());

	fText = NULL;
	//fLabel = NULL;
	fModificationMessage = NULL;
	fLabelAlign = B_ALIGN_LEFT;
	fDivider = 0.0f;
	fPrevWidth = 0;
	fPrevHeight = 0;
	//fClean = true;
	fSkipSetFlags = false;

	int32 flags = 0;

	BFont font(be_bold_font);

	if (!data || !data->HasString("_fname"))
		flags |= B_FONT_FAMILY_AND_STYLE;

	if (!data || !data->HasFloat("_fflt"))
		flags |= B_FONT_SIZE;

	if (flags != 0)
		SetFont(&font, flags);

	if (label)
		fDivider = bounds.Width() / 2.0f;

	if (Flags() & B_NAVIGABLE) {
		fSkipSetFlags = true;
		SetFlags(Flags() & ~B_NAVIGABLE);
		fSkipSetFlags = false;
	}

	if (data)
		fText = static_cast<_BTextInput_ *>(FindView("_input_"));
	else {
		BRect frame(fDivider, bounds.top + 2.0f, bounds.right - 2.0f,
			bounds.bottom - 2.0f);
		BRect textRect(frame.OffsetToCopy(0.0f, 0.0f));
	
		fText = new _BTextInput_(frame, textRect,
			B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS |
			B_NAVIGABLE);

		AddChild(fText);
		
		SetText(initial_text);
		fText->SetAlignment(B_ALIGN_LEFT);
		fText->AlignTextRect();
	}
}
コード例 #18
0
ファイル: TextDiffView.cpp プロジェクト: ModeenF/ponpokodiff
/**
 *	@brief	Diff ペインにフォーカスを与えます。
 *	@param[in]	paneIndex	フォーカスを与えるペイン
 */
void TextDiffView::makeFocusToPane(TextDiffView::PaneIndex /* paneIndex */)
{
	// ホイールイベントのために常に右ペインにフォーカスを与えます。
	// 必要ならここでフォーカスのあるはずのペインを記憶してもいいかも
	BView* rightPaneView = FindView(NAME_RIGHT_PANE);
	if (NULL != rightPaneView)
	{
		rightPaneView->MakeFocus();
	}
}
コード例 #19
0
ファイル: HAddressView.cpp プロジェクト: HaikuArchives/Scooby
/***********************************************************
 * AccountName
 ***********************************************************/
const char*
HAddressView::AccountName()
{
	BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
	BMenu *menu = field->Menu();
	BMenuItem *item = menu->FindMarked();
	if(!item)
		return NULL;
	return item->Label();
}
コード例 #20
0
ファイル: ProtocolConfigView.cpp プロジェクト: mylegacy/haiku
void
BMailProtocolConfigView::AddFlavor(const char *label)
{
	BMenuField *menu = (BMenuField *)(FindView("flavor"));
	if (menu != NULL) {
		menu->Menu()->AddItem(new BMenuItem(label,NULL));
		if (menu->Menu()->FindMarked() == NULL)
			menu->Menu()->ItemAt(0)->SetMarked(true);
	}
}
コード例 #21
0
ファイル: ToolTip.cpp プロジェクト: BackupTheBerlios/beae-svn
int32 ToolTip::Tool_Thread(){
   BPoint loc;
   BPoint oldloc;
   ulong button;
   int32 count = 0;
   BView *v = NULL;
   
   // Wait until the BApplication becomes valid, in case
   // someone creates this as a global variable.
   while(!be_app_messenger.IsValid()){
      snooze(200000);
   }
   
   // while the app is valid, run. This is a 
   // easy way to let the thread natually die
	while(be_app_messenger.IsValid()){
		if(ttWin->Lock()){
			ttWin->ChildAt(0)->GetMouse(&loc, &button);
			ttWin->ConvertToScreen(&loc);
			if((loc == oldloc) && !button){
				if(count == 5){
					if(ttWin->IsHidden()){
						BPoint tr = loc;
						v = FindView(tr);
						const char *tip = NULL;
						while(v && (tip = GetTip(v)) == NULL){
							v = v->Parent();
						}
						if(tip){
							if(tip && strcmp(tip,"")){
								ttWin->Tip(loc,tip);
							}else{
								//ttWin->Tip(loc,"whats up with the No tip haven tool?");
							}
						}
					}
				}else{
					count++;
				}
			}else{
				count = 0;
				if(!(ttWin->IsHidden())){
					ttWin->Bye();
				}
			}
			oldloc = loc;
			ttWin->Unlock();
			//snooze(250000);
			snooze(150000);
		}else{
			snooze(1000000);
		}
	}
	return B_OK;
}
コード例 #22
0
ファイル: Alert.cpp プロジェクト: mmanley/Antares
BAlert::BAlert(BMessage* data)
	: BWindow(data)
{
	fInvoker = NULL;
	fAlertSem = -1;
	fAlertValue = -1;

	fTextView = (BTextView*)FindView("_tv_");

	fButtons[0] = (BButton*)FindView("_b0_");
	fButtons[1] = (BButton*)FindView("_b1_");
	fButtons[2] = (BButton*)FindView("_b2_");

	if (fButtons[2])
		SetDefaultButton(fButtons[2]);
	else if (fButtons[1])
		SetDefaultButton(fButtons[1]);
	else if (fButtons[0])
		SetDefaultButton(fButtons[0]);

	TAlertView* view = (TAlertView*)FindView("_master_");
	if (view)
		view->SetBitmap(_InitIcon());

	// Get keys
	char key;
	for (int32 i = 0; i < 3; ++i) {
		if (data->FindInt8("_but_key", i, (int8*)&key) == B_OK)
			fKeys[i] = key;
	}

	int32 temp;
	// Get alert type
	if (data->FindInt32("_atype", &temp) == B_OK)
		fMsgType = (alert_type)temp;

	// Get button width
	if (data->FindInt32("_but_width", &temp) == B_OK)
		fButtonWidth = (button_width)temp;

	AddCommonFilter(new(std::nothrow) _BAlertFilter_(this));
}
コード例 #23
0
void ParameterWindow::_updateParameterView(
    BMediaTheme *theme) {
    D_INTERNAL(("ParameterWindow::_updateParameterView()\n"));

    // clear the old version
    if (m_parameters) {
        ParameterContainerView *view = dynamic_cast<ParameterContainerView *>(FindView("ParameterContainerView"));
        RemoveChild(view);
        delete m_parameters;
        m_parameters = 0;
        delete view;
    }

    // fetch ParameterWeb from the MediaRoster
    BMediaRoster *roster = BMediaRoster::CurrentRoster();
    if (roster) {
        BParameterWeb *web;
        status_t error = roster->GetParameterWebFor(m_node, &web);
        if (!error && (web->CountParameters() || web->CountGroups())) {
            // if no theme was specified, use the preferred theme
            if (!theme) {
                theme = BMediaTheme::PreferredTheme();
            }
            // acquire the view
            m_parameters = BMediaTheme::ViewFor(web, 0, theme);
            if (m_parameters) {
                BMenuBar *menuBar = KeyMenuBar();
                m_idealSize = m_parameters->Bounds();
                m_idealSize.right += B_V_SCROLL_BAR_WIDTH;
                m_idealSize.bottom += B_H_SCROLL_BAR_HEIGHT;
                if (menuBar) {
                    m_parameters->MoveTo(0.0, menuBar->Bounds().bottom + 1.0);
                    m_idealSize.bottom += menuBar->Bounds().bottom + 1.0;
                }
            }
        }
    }

    // limit min size to avoid funny-looking scrollbars
    float hMin = B_V_SCROLL_BAR_WIDTH*6, vMin = B_H_SCROLL_BAR_HEIGHT*3;
    // limit max size to full extents of the parameter view
    float hMax = m_idealSize.Width(), vMax = m_idealSize.Height();
    SetSizeLimits(hMin, hMax, vMin, vMax);

    // adapt the window to the new dimensions
    ResizeTo(m_idealSize.Width(), m_idealSize.Height());
    m_zoomed = true;

    if (m_parameters) {
        BRect paramRect = m_parameters->Bounds();
        AddChild(new ParameterContainerView(paramRect, m_parameters));
    }
}
コード例 #24
0
/**
 *	@brief	Diff Them ボタンの処理
 */
void OpenFilesDialog::doDiffThem()
{
	const char* text = NULL;
	BTextControl* textControl;
	
	// 左側
	text = NULL;
	textControl = dynamic_cast<BTextControl*>(FindView(NAME_LEFT_TEXT_CONTROL));
	if (NULL != textControl)
	{
		text = textControl->Text();
	}
	if (NULL == text || '\0' == text[0])
	{
		// 左側ファイルが指定されていません
		// TODO:
		return;
	}
	BPath leftPath(text);
	
	// 右側
	text = NULL;
	textControl = dynamic_cast<BTextControl*>(FindView(NAME_RIGHT_TEXT_CONTROL));
	if (NULL != textControl)
	{
		text = textControl->Text();
	}
	if (NULL == text || '\0' == text[0])
	{
		// 左側ファイルが指定されていません
		// TODO:
		return;
	}
	BPath rightPath(text);
	
	PonpokoDiffApp* app = static_cast<PonpokoDiffApp*>(be_app);
	TextDiffWnd* newDiffWnd = app->NewTextDiffWnd();
	newDiffWnd->ExecuteDiff(leftPath, rightPath, NULL, NULL);
	PostMessage(B_QUIT_REQUESTED);
}
コード例 #25
0
ファイル: imap_config.cpp プロジェクト: mmanley/Antares
IMAPConfig::IMAPConfig(BMessage *archive)
	: BMailProtocolConfigView(B_MAIL_PROTOCOL_HAS_USERNAME
		| B_MAIL_PROTOCOL_HAS_PASSWORD | B_MAIL_PROTOCOL_HAS_HOSTNAME
		| B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER
#ifdef USE_SSL
	 	| B_MAIL_PROTOCOL_HAS_FLAVORS
#endif
	 )
{
#ifdef USE_SSL
		AddFlavor("No encryption");
		AddFlavor("SSL");
#endif

	SetTo(archive);

	((BControl *)(FindView("leave_mail_remote")))->SetValue(B_CONTROL_ON);
	((BControl *)(FindView("leave_mail_remote")))->Hide();

	BRect frame = FindView("delete_remote_when_local")->Frame();

	((BControl *)(FindView("delete_remote_when_local")))->SetEnabled(true);
	((BControl *)(FindView("delete_remote_when_local")))->MoveBy(0,-25);


	frame.right -= 10;// FindView("pass")->Frame().right;
	/*frame.top += 10;
	frame.bottom += 10;*/

	BTextControl *folder = new BTextControl(frame,"root","Top mailbox folder: ","",NULL);
	folder->SetDivider(be_plain_font->StringWidth("Top mailbox folder: "));

	if (archive->HasString("root"))
		folder->SetText(archive->FindString("root"));

	AddChild(folder);

	ResizeToPreferred();
}
コード例 #26
0
ファイル: TextDiffView.cpp プロジェクト: ModeenF/ponpokodiff
/**
 *	@brief	レイアウトを調整します。
 */
void TextDiffView::recalcLayout()
{
	BRect bounds = Bounds();
	float leftWidth = floor((bounds.Width() + 1 - B_H_SCROLL_BAR_HEIGHT - PANE_SPLITTER_WIDTH) / 2);
	float rightWidth = (bounds.Width() + 1 - PANE_SPLITTER_WIDTH) - leftWidth;

	// 左ペイン
	BView* leftPaneView = FindView(NAME_LEFT_PANE_SCROLLER);
	if (NULL != leftPaneView)
	{
		leftPaneView->MoveTo(bounds.left, bounds.top);
		leftPaneView->ResizeTo(leftWidth - 1, bounds.Height());
	}
	
	// 右ペイン
	BView* rightPaneView = FindView(NAME_RIGHT_PANE_SCROLLER);
	if (NULL != rightPaneView)
	{
		rightPaneView->MoveTo(bounds.left + leftWidth + PANE_SPLITTER_WIDTH, bounds.top);
		rightPaneView->ResizeTo(rightWidth - 1, bounds.Height());
	}
}
コード例 #27
0
ファイル: WebViewModule.cpp プロジェクト: wolfspelz/Apollo
void WebViewModule::DeleteView(const ApHandle& hView)
{
  View* pView = FindView(hView);
  if (pView) {
    pView->Destroy();
    views_.Unset(hView);
    int nRefCnt = pView->Release();
    if (nRefCnt > 0) {
      delete pView;
    }
    pView = 0;
  }
}
コード例 #28
0
ファイル: TextControl.cpp プロジェクト: mmanley/Antares
void
BTextControl::_InitData(const char* label, const char* initialText,
	BMessage* archive)
{
	BRect bounds(Bounds());

	fText = NULL;
	fModificationMessage = NULL;
	fLabelAlign = B_ALIGN_LEFT;
	fDivider = 0.0f;
	fLayoutData = new LayoutData(bounds.Width(), bounds.Height());

	int32 flags = 0;

	BFont font(be_plain_font);

	if (!archive || !archive->HasString("_fname"))
		flags |= B_FONT_FAMILY_AND_STYLE;

	if (!archive || !archive->HasFloat("_fflt"))
		flags |= B_FONT_SIZE;

	if (flags != 0)
		SetFont(&font, flags);

	if (label)
		fDivider = floorf(bounds.Width() / 2.0f);

	uint32 navigableFlags = Flags() & B_NAVIGABLE;
	if (navigableFlags != 0) 	 
		BView::SetFlags(Flags() & ~B_NAVIGABLE);

	if (archive)
		fText = static_cast<BPrivate::_BTextInput_*>(FindView("_input_"));

	if (fText == NULL) {
		BRect frame(fDivider, bounds.top, bounds.right, bounds.bottom);
		// we are stroking the frame around the text view, which
		// is 2 pixels wide
		frame.InsetBy(kFrameMargin, kFrameMargin);
		BRect textRect(frame.OffsetToCopy(B_ORIGIN));

		fText = new BPrivate::_BTextInput_(frame, textRect,
			B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | navigableFlags);
		AddChild(fText);

		SetText(initialText);
		fText->SetAlignment(B_ALIGN_LEFT);
		fText->AlignTextRect();
	}
}
コード例 #29
0
void CMcviewDlg::doAutoPopup()
{
	// 2004/5/30, auto-popups
	do{
		__uint i;
		static bool bPopupInited;
		CAutoPopup::popupEntry_t * ent;
		
		if(!bPopupInited){
			autoPopups.init();
			bPopupInited = true;
		}
		ent = autoPopups.entries;
		if(!lock_rtdb(__false, 1000)){
			break;
		}
		for(i=0; i<autoPopups.nEntries; i++, ent++){
			//
			PCRTK_TAG tag;
			bool bPopup;
			
			tag = query_tag_f(&ent->tn);
			if(!tag){
				continue;
			}
			if(get_value_type(tag->s.Flags) != dt_bool){
				continue;
			}
			bPopup = tag->d.Value.Value.b? true : false;
			if(!(ent->flags & popupWhenVariableIsOn)){
				bPopup = !bPopup;
			}
			if(bPopup){
				if(ent->flags & popupOverlay){
					theView.LoadFile(ent->associatedPicture);
				}else{
					PopupView(ent->associatedPicture);
				}
			}else{
				if((ent->flags & popupAutoHide) && !(ent->flags & popupOverlay)){
					CFView * view;
					view = FindView(ent->associatedPicture);
					if(view){
						view->CloseWindow();
					}
				}
			}
		}
		unlock_rtdb();
	}while(0);
}
コード例 #30
0
void
TFilePanel::SetSaveText(const char* text)
{
	if (text == NULL)
		return;

	BTextControl* textControl
		= dynamic_cast<BTextControl*>(FindView("text view"));
	if (textControl != NULL) {
		textControl->SetText(text);
		if (textControl->TextView() != NULL)
			textControl->TextView()->SelectAll();
	}
}