Exemplo n.º 1
0
MessageWindow::MessageWindow (
  const char *id_,
  int32 sid_,
  const char *serverName_,
  const BMessenger &sMsgr_,
  const char *nick,
  const char *addyString,
  bool chat,
  bool initiate,
  const char *IP,
  const char *port)

  : ClientWindow (
      id_,
      sid_,
      serverName_,
      sMsgr_,
      nick,
      BRect(110,110,730,420)),

      chatAddy (addyString ? addyString : ""),
      chatee (id_),
      dIP (IP),
      dPort (port),
      dChat (chat),
      dInitiate (initiate),
      dConnected (false)
{

  if (dChat)
  {
    if (dInitiate)
    {
      DCCServerSetup();
      dataThread = spawn_thread(DCCIn, "DCC Chat(I)", B_NORMAL_PRIORITY, this);
    }
    else
      dataThread = spawn_thread(DCCOut, "DCC Chat(O)", B_NORMAL_PRIORITY, this);
    
    resume_thread (dataThread);
  }

  if (dInitiate)
    SetFlags (B_AVOID_FOCUS);

  status->AddItem (new StatusItem (
                         serverName.String(), 0),
                         true);

  status->AddItem (new StatusItem(
                         "Lag: ", 0,
                         STATUS_ALIGN_LEFT),
                         true);
                         
  status->AddItem (new StatusItem (
                         0,
                         "@@@@@@@@@@@@@@@@@",
                         STATUS_ALIGN_LEFT),
                         true);
	
  status->SetItemValue (STATUS_LAG, "0.000");	
  status->SetItemValue (STATUS_NICK, myNick.String());

  BString titleString (id);
  if (addyString && *addyString)
    titleString << " (" << addyString << ")";

  SetTitle (titleString.String());
  SetSizeLimits (300,2000,150,2000);

}
Exemplo n.º 2
0
// show task properties
//
void CDlgItemProperties::renderInfos(RESULT* result) {
    CMainDocument* pDoc = wxGetApp().GetDocument();
    wxDateTime dt;
    wxString wxTitle = _("Properties of task ");
    wxTitle.append(wxString(result->name, wxConvUTF8));
    SetTitle(wxTitle);

    APP_VERSION* avp = NULL;
    WORKUNIT* wup = NULL;
    RESULT* r = pDoc->state.lookup_result(result->project_url, result->name);
    if (r) {
        avp = r->avp;
        wup = r->wup;
    }
    
    addProperty(_("Application"), FormatApplicationName(result));
    addProperty(_("Name"), wxString(result->wu_name, wxConvUTF8));
    addProperty(_("State"), result_description(result, false));
    if (result->received_time) {
        dt.Set((time_t)result->received_time);
        addProperty(_("Received"), dt.Format());
    }
    dt.Set((time_t)result->report_deadline);
    addProperty(_("Report deadline"), dt.Format());
    if (strlen(result->resources)) {
        addProperty(_("Resources"), wxString(result->resources, wxConvUTF8));
    }
    if (wup) {
        addProperty(_("Estimated computation size"), wxString::Format(wxT("%.0f GFLOPs"), wup->rsc_fpops_est/1e9));
    }
    if (result->active_task) {
        addProperty(_("CPU time at last checkpoint"), FormatTime(result->checkpoint_cpu_time));
        addProperty(_("CPU time"), FormatTime(result->current_cpu_time));
        if (result->elapsed_time >= 0) {
            addProperty(_("Elapsed time"), FormatTime(result->elapsed_time));
        }
        addProperty(_("Estimated time remaining"), FormatTime(result->estimated_cpu_time_remaining));
        addProperty(_("Fraction done"), wxString::Format(wxT("%.3f %%"), result->fraction_done*100));
        addProperty(_("Virtual memory size"), FormatDiskSpace(result->swap_size));
        addProperty(_("Working set size"), FormatDiskSpace(result->working_set_size_smoothed));
        if (result->slot >= 0) {
            addProperty(_("Directory"), wxString::Format(wxT("slots/%d"), result->slot));
        }
        if (result->pid) {
            addProperty(_("Process ID"), wxString::Format(wxT("%d"), result->pid));
        }
        if (result->progress_rate) {
            // express rate in the largest time unit (hr/min/sec) for which rate < 100%
            //
            if (result->progress_rate*3600 < 1) {
                addProperty(_("Progress rate"), wxString::Format(wxT("%f %% %s"), 100*3600*result->progress_rate, _("per hour")));
            } else if (result->progress_rate*60 < 1) {
                addProperty(_("Progress rate"), wxString::Format(wxT("%f %% %s"), 100*60*result->progress_rate, _("per minute")));
            } else {
                addProperty(_("Progress rate"), wxString::Format(wxT("%f %% %s"), 100*result->progress_rate, _("per second")));
            }
        }
    } else if (result->state >= RESULT_COMPUTE_ERROR) {
        addProperty(_("CPU time"), FormatTime(result->final_cpu_time));
        addProperty(_("Elapsed time"), FormatTime(result->final_elapsed_time));
    }
    if (avp) {
        addProperty(_("Executable"), wxString(avp->exec_filename, wxConvUTF8));
    }
    m_gbSizer->Layout();
    m_scrolledWindow->FitInside();
}
Exemplo n.º 3
0
void
PersonWindow::MessageReceived(BMessage* msg)
{
	char			str[256];
	BDirectory		directory;
	BEntry			entry;
	BFile			file;
	BNodeInfo		*node;

	switch (msg->what) {
		case M_SAVE:
			if (!fRef) {
				SaveAs();
				break;
			}
			// supposed to fall through
		case M_REVERT:
		case M_SELECT:
			fView->MessageReceived(msg);
			break;

		case M_SAVE_AS:
			SaveAs();
			break;

		case B_UNDO: // fall through
		case B_CUT:
		case B_COPY:
		case B_PASTE:
		{
			BView* view = CurrentFocus();
			if (view != NULL)
				view->MessageReceived(msg);
			break;
		}

		case B_SAVE_REQUESTED:
		{
			entry_ref dir;
			if (msg->FindRef("directory", &dir) == B_OK) {
				const char* name = NULL;
				msg->FindString("name", &name);
				directory.SetTo(&dir);
				if (directory.InitCheck() == B_NO_ERROR) {
					directory.CreateFile(name, &file);
					if (file.InitCheck() == B_NO_ERROR) {
						node = new BNodeInfo(&file);
						node->SetType("application/x-person");
						delete node;

						directory.FindEntry(name, &entry);
						entry.GetRef(&dir);
						_SetToRef(new entry_ref(dir));
						SetTitle(fRef->name);
						fView->CreateFile(fRef);
					}
					else {
						sprintf(str, B_TRANSLATE("Could not create %s."), name);
						BAlert* alert = new BAlert("", str, B_TRANSLATE("Sorry"));
						alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
						alert->Go();
					}
				}
			}
			break;
		}

		case B_NODE_MONITOR:
		{
			int32 opcode;
			if (msg->FindInt32("opcode", &opcode) == B_OK) {
				switch (opcode) {
					case B_ENTRY_REMOVED:
						// We lost our file. Close the window.
						PostMessage(B_QUIT_REQUESTED);
						break;

					case B_ENTRY_MOVED:
					{
						// We may have renamed our entry. Obtain relevant data
						// from message.
						BString name;
						msg->FindString("name", &name);

						int64 directory;
						msg->FindInt64("to directory", &directory);

						int32 device;
						msg->FindInt32("device", &device);

						// Update our ref.
						delete fRef;
						fRef = new entry_ref(device, directory, name.String());

						// And our window title.
						SetTitle(name);

						// If moved to Trash, close window.
						BVolume volume(device);
						BPath trash;
						find_directory(B_TRASH_DIRECTORY, &trash, false,
							&volume);
						BPath folder(fRef);
						folder.GetParent(&folder);
						if (folder == trash)
							PostMessage(B_QUIT_REQUESTED);

						break;
					}

					case B_ATTR_CHANGED:
					{
						// An attribute was updated.
						BString attr;
						if (msg->FindString("attr", &attr) == B_OK)
							fView->SetAttribute(attr.String(), true);
						break;
					}
					case B_STAT_CHANGED:
						fView->UpdatePicture(fRef);
						break;
				}
			}
			break;
		}

		default:
			BWindow::MessageReceived(msg);
	}
}
bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataToWindow()
{
    // Set unit symbol
    wxStaticText* texts_unit[] =
    {
        m_StartPointXUnit,
        m_StartPointYUnit,
        m_EndPointXUnit,
        m_EndPointYUnit,
        m_ThicknessTextUnit,
        m_DefaulThicknessTextUnit,
    };

    for( size_t ii = 0; ii < DIM( texts_unit ); ii++ )
    {
        texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() );
    }

    wxString msg;

    // Change texts according to the segment shape:
    switch( m_item->GetShape() )
    {
    case S_CIRCLE:
        SetTitle( _( "Circle Properties" ) );
        m_StartPointXLabel->SetLabel( _( "Center X" ) );
        m_StartPointYLabel->SetLabel( _( "Center Y" ) );
        m_EndPointXLabel->SetLabel( _( "Point X" ) );
        m_EndPointYLabel->SetLabel( _( "Point Y" ) );
        m_AngleText->Show( false );
        m_AngleCtrl->Show( false );
        m_AngleUnit->Show( false );
        break;

    case S_ARC:
        SetTitle( _( "Arc Properties" ) );
        m_StartPointXLabel->SetLabel( _( "Center X" ) );
        m_StartPointYLabel->SetLabel( _( "Center Y" ) );
        m_EndPointXLabel->SetLabel( _( "Start Point X" ) );
        m_EndPointYLabel->SetLabel( _( "Start Point Y" ) );

        m_AngleValue = m_item->GetAngle() / 10.0;
        break;

    case S_SEGMENT:
        SetTitle( _( "Line Segment Properties" ) );

        // Fall through.
    default:
        m_AngleText->Show( false );
        m_AngleCtrl->Show( false );
        m_AngleUnit->Show( false );
        break;
    }

    PutValueInLocalUnits( *m_Center_StartXCtrl, m_item->GetStart().x );

    PutValueInLocalUnits( *m_Center_StartYCtrl, m_item->GetStart().y );

    PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetEnd().x );

    PutValueInLocalUnits( *m_EndY_Ctrl, m_item->GetEnd().y );

    PutValueInLocalUnits( *m_ThicknessCtrl, m_item->GetWidth() );

    PutValueInLocalUnits( *m_DefaultThicknessCtrl, m_brdSettings.m_ModuleSegmentWidth );

    // Configure the layers list selector
    m_LayerSelectionCtrl->SetLayersHotkeys( false );
    m_LayerSelectionCtrl->SetLayerSet( LSET::InternalCuMask().set( Edge_Cuts ) );
    m_LayerSelectionCtrl->SetBoardFrame( m_parent );
    m_LayerSelectionCtrl->Resync();

    if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 )
    {
        wxMessageBox( _( "This item was on an unknown layer.\n"
                         "It has been moved to the front silk screen layer. Please fix it." ) );
        m_LayerSelectionCtrl->SetLayerSelection( F_SilkS );
    }

    return DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataToWindow();
}
Exemplo n.º 5
0
bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin CDlgEventLog member initialisation
    CMainDocument* pDoc     = wxGetApp().GetDocument();
    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));
    
    m_iPreviousRowCount = 0;
    m_iTotalDocCount = 0;
    m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
    m_iPreviousLastMsgSeqNum = m_iPreviousFirstMsgSeqNum - 1;

    m_iNumDeletedFilteredRows = 0;
    m_iTotalDeletedFilterRows = 0;
    
    if (!s_bIsFiltered) {
        s_strFilteredProjectName.clear();
    }
    m_iFilteredIndexes.Clear();
	m_bProcessingRefreshEvent = false;
    m_bWasConnected = false;
    m_bEventLogIsOpen = true;
////@end CDlgEventLog member initialisation

    CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    wxPoint oTempPoint;
    wxSize  oTempSize;

    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));

    if ((pos == wxDefaultPosition) && (size == wxDefaultSize)) {
        // Get size and position from the previous configuration
        GetWindowDimensions( oTempPoint, oTempSize );

#ifdef __WXMSW__
        // Get the current display space for the current window
		int iDisplay = wxNOT_FOUND;
		if ( wxGetApp().GetFrame() != NULL )
            iDisplay = wxDisplay::GetFromWindow(wxGetApp().GetFrame());
		if ( iDisplay == wxNOT_FOUND )
            iDisplay = 0;
        wxDisplay *display = new wxDisplay(iDisplay);
        wxRect rDisplay = display->GetClientArea();

		// Check that the saved height and width is not larger than the displayable space.
		// If it is, then reduce the size.
        if ( oTempSize.GetWidth() > rDisplay.width ) oTempSize.SetWidth(rDisplay.width);
        if ( oTempSize.GetHeight() > rDisplay.height ) oTempSize.SetHeight(rDisplay.height);

        // Check if part of the display was going to be off the screen, if so, center the 
        // display on that axis
		if ( oTempPoint.x < rDisplay.x ) {
			oTempPoint.x = rDisplay.x;
		} else if ( oTempPoint.x + oTempSize.GetWidth() > rDisplay.x + rDisplay.width ) {
			oTempPoint.x = rDisplay.x + rDisplay.width - oTempSize.GetWidth();
		}

		if ( oTempPoint.y < rDisplay.y ) {
			oTempPoint.y = rDisplay.y;
		} else if ( oTempPoint.y + oTempSize.GetHeight() > rDisplay.y + rDisplay.height ) {
			oTempPoint.y = rDisplay.y + rDisplay.height - oTempSize.GetHeight();
		}

        delete display;
#endif
#ifdef __WXMAC__
        // If the user has changed the arrangement of multiple 
        // displays, make sure the window title bar is still on-screen.
    if (!IsWindowOnScreen(oTempPoint.x, oTempPoint.y, oTempSize.GetWidth(), oTempSize.GetHeight())) {
        oTempPoint.y = oTempPoint.x = 30;
    }
#endif  // ! __WXMAC__
    } else {
        oTempPoint = pos;
        oTempSize = size;
    }

    DlgEventLogBase::Create( parent, id, caption, oTempPoint, oTempSize, style );

    SetSizeHints(DLGEVENTLOG_MIN_WIDTH, DLGEVENTLOG_MIN_HEIGHT);
    SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);

    // Initialize Application Title
    wxString strCaption = caption;
    if (strCaption.IsEmpty()) {
        strCaption.Printf(_("%s - Event Log"), pSkinAdvanced->GetApplicationName().c_str());
    }
    SetTitle(strCaption);

    // Initialize Application Icon
    SetIcons(*pSkinAdvanced->GetApplicationIcon());

    CreateControls();

	// Create List Pane Items
    m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109);
    m_pList->InsertColumn(COLUMN_TIME, _("Time"), wxLIST_FORMAT_LEFT, 130);
    m_pList->InsertColumn(COLUMN_MESSAGE, _("Message"), wxLIST_FORMAT_LEFT, 378);

    m_pMessageInfoAttr = new wxListItemAttr(
        wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
        wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
        wxNullFont
    );
    m_pMessageErrorAttr = new wxListItemAttr(
        *wxRED,
        wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
        wxNullFont
    );

#if EVENT_LOG_STRIPES
    m_pList->EnableAlternateRowColours();
    wxColour stripe_color;

#if wxCHECK_VERSION(3, 1, 0)
    stripe_color = m_pList->GetAlternateRowColour();
    if (!stripe_color.IsOk())
#endif
    {
        // copied from wxListCtrlBase::EnableAlternateRowColours(bool)

        // Determine the alternate rows colour automatically from the
        // background colour.
        const wxColour bgColour = m_pList->GetBackgroundColour();

        // Depending on the background, alternate row color
        // will be 3% more dark or 50% brighter.
        int alpha = bgColour.GetRGB() > 0x808080 ? 97 : 150;
        stripe_color = bgColour.ChangeLightness(alpha);
    }

#ifdef __WXMSW__
    // work around a bug in wxWidgets 3.1 and earlier
    // if row background color is wxSYS_COLOR_BTNFACE selected unfocused row is drawn with wrong colors
    if (stripe_color == wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)) {
        // adjust the color just enough to make it different
        stripe_color.SetRGB(stripe_color.GetRGB() + 1);
    }
#endif

    m_pMessageInfoGrayAttr = new wxListItemAttr(
        wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
        stripe_color,
        wxNullFont
    );
    m_pMessageErrorGrayAttr = new wxListItemAttr(
        *wxRED,
        stripe_color,
        wxNullFont
    );
#else
    m_pMessageInfoGrayAttr = new wxListItemAttr(*m_pMessageInfoAttr);
    m_pMessageErrorGrayAttr = new wxListItemAttr(*m_pMessageErrorAttr);
#endif

    SetTextColor();
    RestoreState();
    OnRefresh();
    // Register that we had the Event Log open immediately
    SaveState();
    
    m_Shortcuts[0].Set(wxACCEL_CTRL|wxACCEL_SHIFT, (int)'F', ID_SGDIAGNOSTICLOGFLAGS);
    m_pAccelTable = new wxAcceleratorTable(1, m_Shortcuts);

    SetAcceleratorTable(*m_pAccelTable);

    return true;
}
Exemplo n.º 6
0
CStaticText::CStaticText(const int vx,const int vy,const int vw,const int vh,CWnd* vowner,const PCHAR text)
:CWnd(NULL,vx,vy,vw,vh,vowner)
{
	SetTitle(text);
	canfocus=FALSE;
}
Exemplo n.º 7
0
void PowerManDlg::initLabels() {
    TraceOp.trc( "boosterdlg", TRCLEVEL_INFO, __LINE__, 9999, "initLabels" );
    SetTitle(wxGetApp().getMsg( "boostertable" ));
    m_BoosterBook->SetPageText( 0, wxGetApp().getMsg( "index" ) );
    m_BoosterBook->SetPageText( 1, wxGetApp().getMsg( "general" ) );
    m_BoosterBook->SetPageText( 2, wxGetApp().getMsg( "modules" ) );
    m_BoosterBook->SetPageText( 3, wxGetApp().getMsg( "blocks" ) );
    m_BoosterBook->SetPageText( 4, wxGetApp().getMsg( "details" ) );

    // Index
    m_AddBooster->SetLabel( wxGetApp().getMsg( "new" ) );
    m_DelBooster->SetLabel( wxGetApp().getMsg( "delete" ) );
    m_AddModule->SetLabel( wxGetApp().getMsg( "add" ) );
    m_DelModule->SetLabel( wxGetApp().getMsg( "delete" ) );
    m_AddBlock->SetLabel( wxGetApp().getMsg( "add" ) );
    m_DelBlock->SetLabel( wxGetApp().getMsg( "delete" ) );

    m_BoosterList->InsertColumn(0, wxGetApp().getMsg( "id" ), wxLIST_FORMAT_LEFT );
    m_BoosterList->InsertColumn(1, wxGetApp().getMsg( "powerdistrict" ), wxLIST_FORMAT_LEFT );
    m_BoosterList->InsertColumn(2, wxGetApp().getMsg( "uid" ), wxLIST_FORMAT_LEFT );

    // General
    m_labID->SetLabel( wxGetApp().getMsg( "id" ) );
    m_labIID->SetLabel( wxGetApp().getMsg( "iid" ) );
    m_labDistrict->SetLabel( wxGetApp().getMsg( "powerdistrict" ) );

    iONode model = wxGetApp().getModel();
    iOList list = ListOp.inst();
    if( model != NULL ) {
        int cnt = 0;
        iONode bklist = wPlan.getbklist( model );
        iONode sblist = wPlan.getsblist( model );
        iONode ttlist = wPlan.getttlist( model );
        iONode fylist = wPlan.getseltablist( model );
        if( bklist != NULL ) {
            cnt = NodeOp.getChildCnt( bklist );
            for( int i = 0; i < cnt; i++ ) {
                iONode bk = NodeOp.getChild( bklist, i );
                ListOp.add(list, (obj)wItem.getid( bk ));
            }
        }
        if( sblist != NULL ) {
            cnt = NodeOp.getChildCnt( sblist );
            for( int i = 0; i < cnt; i++ ) {
                iONode sb = NodeOp.getChild( sblist, i );
                ListOp.add(list, (obj)wItem.getid( sb ));
            }
        }
        if( ttlist != NULL ) {
            cnt = NodeOp.getChildCnt( ttlist );
            for( int i = 0; i < cnt; i++ ) {
                iONode tt = NodeOp.getChild( ttlist, i );
                ListOp.add(list, (obj)wItem.getid( tt ));
            }
        }
        if( fylist != NULL ) {
            cnt = NodeOp.getChildCnt( fylist );
            for( int i = 0; i < cnt; i++ ) {
                iONode fy = NodeOp.getChild( fylist, i );
                ListOp.add(list, (obj)wItem.getid( fy ));
            }
        }

        ListOp.sort(list, &__sortStr);
        cnt = ListOp.size( list );
        for( int i = 0; i < cnt; i++ ) {
            const char* id = (const char*)ListOp.get( list, i );
            m_BlocksCombo->Append( wxString(id,wxConvUTF8) );
        }

    }
    /* clean up the temp. list */
    ListOp.base.del(list);

    list = ListOp.inst();
    if( model != NULL ) {
        iONode fblist = wPlan.getfblist( model );
        if( fblist != NULL ) {
            int cnt = NodeOp.getChildCnt( fblist );
            for( int i = 0; i < cnt; i++ ) {
                iONode fb = NodeOp.getChild( fblist, i );
                const char* id = wFeedback.getid( fb );
                if( id != NULL ) {
                    ListOp.add(list, (obj)id);
                }
            }
            m_ShortcutSensor->Append( _T("-") );
            m_PowerSensor->Append( _T("-") );
            ListOp.sort(list, &__sortStr);
            cnt = ListOp.size( list );
            for( int i = 0; i < cnt; i++ ) {
                const char* id = (const char*)ListOp.get( list, i );
                m_ShortcutSensor->Append( wxString(id,wxConvUTF8) );
                m_PowerSensor->Append( wxString(id,wxConvUTF8) );
            }
        }
    }
    /* clean up the temp. list */
    ListOp.base.del(list);


    list = ListOp.inst();
    if( model != NULL ) {
        iONode colist = wPlan.getcolist( model );
        if( colist != NULL ) {
            int cnt = NodeOp.getChildCnt( colist );
            for( int i = 0; i < cnt; i++ ) {
                iONode co = NodeOp.getChild( colist, i );
                const char* id = wOutput.getid( co );
                if( id != NULL ) {
                    ListOp.add(list, (obj)id);
                }
            }
            m_PowerOutput->Append( _T("-") );
            ListOp.sort(list, &__sortStr);
            cnt = ListOp.size( list );
            for( int i = 0; i < cnt; i++ ) {
                const char* id = (const char*)ListOp.get( list, i );
                m_PowerOutput->Append( wxString(id,wxConvUTF8) );
            }
        }
    }
    /* clean up the temp. list */
    ListOp.base.del(list);

    m_labShortcutSensor->SetLabel( wxGetApp().getMsg( "shortcutsensor" ) );
    m_labPowerSensor->SetLabel( wxGetApp().getMsg( "powersensor" ) );
    m_labPowerOutput->SetLabel( wxGetApp().getMsg( "poweroutput" ) );
    m_labUID->SetLabel( wxGetApp().getMsg( "uid" ) );

    m_labModuleID->SetLabel( wxGetApp().getMsg( "modid" ) );

    // Options
    m_StopDistrictLocos->SetLabel( wxGetApp().getMsg( "scopt_stoplocos" ) );
    m_PowerOffAll->SetLabel( wxGetApp().getMsg( "scopt_poweroffall" ) );
    m_RetryPowerOn->SetLabel( wxGetApp().getMsg( "scopt_repoweron" ) );
    m_DoesReport->SetLabel( wxGetApp().getMsg( "reportstate" ) );

    m_Actions->SetLabel( wxGetApp().getMsg( "actions" )+_T("...") );

}
Exemplo n.º 8
0
void CMyPaintDoc::init() {
  resetHistory();
  SetTitle(s_defaultName);
  CHECKINVARIANT;
}
Exemplo n.º 9
0
TCWin::TCWin( ChartCanvas *parent, int x, int y, void *pvIDX )
{

    //    As a display optimization....
    //    if current color scheme is other than DAY,
    //    Then create the dialog ..WITHOUT.. borders and title bar.
    //    This way, any window decorations set by external themes, etc
    //    will not detract from night-vision

    m_created = false;
    xSpot = 0;
    ySpot = 0;

    m_pTCRolloverWin = NULL;

    long wstyle = wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ;
    if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY )
            && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER );

#ifdef __WXOSX__
     wstyle |= wxSTAY_ON_TOP;
#endif
   
    pParent = parent;
    m_x = x;
    m_y = y;
    
    RecalculateSize();
     
    wxDialog::Create( parent, wxID_ANY, wxString( _T ( "" ) ), m_position ,
                      m_tc_size, wstyle );

    m_created = true;
    wxFont *qFont = GetOCPNScaledFont(_("Dialog"));
    SetFont( *qFont );
    

    pIDX = (IDX_entry *) pvIDX;
    gpIDXn++;

//    Set up plot type
    if( strchr( "Tt", pIDX->IDX_type ) ) {
        m_plot_type = TIDE_PLOT;
        SetTitle( wxString( _( "Tide" ) ) );
        gpIDX = pIDX;       // remember pointer for routeplan

    } else {
        m_plot_type = CURRENT_PLOT;
        SetTitle( wxString( _( "Current" ) ) );
    }



    int sx, sy;
    GetClientSize( &sx, &sy );
    
//    Figure out this computer timezone minute offset
    wxDateTime this_now = gTimeSource;
    bool cur_time = !gTimeSource.IsValid();

    if (cur_time) {
        this_now = wxDateTime::Now();
    }
    wxDateTime this_gmt = this_now.ToGMT();

#if wxCHECK_VERSION(2, 6, 2)
    wxTimeSpan diff = this_now.Subtract( this_gmt );
#else
    wxTimeSpan diff = this_gmt.Subtract ( this_now );
#endif

    int diff_mins = diff.GetMinutes();

    //  Correct a bug in wx3.0.2
    //  If the system TZ happens to be GMT, with DST active (e.g.summer in London),
    //  then wxDateTime returns incorrect results for toGMT() method
#if wxCHECK_VERSION(3, 0, 2)
    if( diff_mins == 0 && this_now.IsDST() )
        diff_mins +=60;
#endif
    int station_offset = ptcmgr->GetStationTimeOffset( pIDX );

    m_corr_mins = station_offset - diff_mins;
    if( this_now.IsDST() ) m_corr_mins += 60;

//    Establish the inital drawing day as today
    m_graphday = this_now;
    wxDateTime graphday_00 = this_now;
    graphday_00.ResetTime();
    time_t t_graphday_00 = graphday_00.GetTicks();

    //    Correct a Bug in wxWidgets time support
    if( !graphday_00.IsDST() && m_graphday.IsDST() ) t_graphday_00 -= 3600;
    if( graphday_00.IsDST() && !m_graphday.IsDST() ) t_graphday_00 += 3600;

    m_t_graphday_00_at_station = t_graphday_00 - ( m_corr_mins * 60 );

    btc_valid = false;

    wxString* TClist = NULL;
    m_tList = new wxListBox( this, -1, wxPoint( sx * 65 / 100, 11 ),
                             wxSize( ( sx * 32 / 100 ), ( sy * 20 / 100 ) ), 0, TClist,
                             wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL  );

    //  Measure the size of a generic button, with label
    wxButton *test_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( -1, -1), wxDefaultSize );
    test_button->GetSize( &m_tsx, &m_tsy );
    delete test_button;
    
    //  In the interest of readability, if the width of the dialog is too narrow, 
    //  simply skip showing the "Hi/Lo" list control.
    
    if( (m_tsy * 15) > sx )
        m_tList->Hide();
    
    
    OK_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( sx - (2 * m_tsy + 10), sy - (m_tsy + 10) ),
                              wxDefaultSize );

    PR_button = new wxButton( this, ID_TCWIN_PR, _( "Prev" ), wxPoint( 10, sy - (m_tsy + 10) ),
                              wxSize( -1, -1 ) );

    wxSize texc_size = wxSize( ( sx * 60 / 100 ), ( sy *29 / 100 ) );
    if( !m_tList->IsShown()){
        texc_size = wxSize( ( sx * 90 / 100 ), ( sy *29 / 100 ) );
    }
        
    m_ptextctrl = new wxTextCtrl( this, -1, _T(""), wxPoint( sx * 3 / 100, 6 ),
                                  texc_size ,
                                  wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
    int bsx, bsy, bpx, bpy;
    PR_button->GetSize( &bsx, &bsy );
    PR_button->GetPosition( &bpx, &bpy );

    NX_button = new wxButton( this, ID_TCWIN_NX, _( "Next" ), wxPoint( bpx + bsx + 5, sy - (m_tsy + 10) ),
                              wxSize( -1, -1 ) );

    m_TCWinPopupTimer.SetOwner( this, TCWININF_TIMER );

    wxScreenDC dc;
    int text_height;
    dc.GetTextExtent(_T("W"), NULL, &text_height);
    m_button_height = m_tsy; //text_height + 20;


    // Build graphics tools

    wxFont *dlg_font = FontMgr::Get().GetFont( _("Dialog") );
    int dlg_font_size = dlg_font->GetPointSize();

    pSFont = FontMgr::Get().FindOrCreateFont( dlg_font_size-2, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL,
                                                    wxFONTWEIGHT_NORMAL, FALSE, wxString( _T ( "Arial" ) ) );
    pSMFont = FontMgr::Get().FindOrCreateFont( dlg_font_size-1, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL,
                                                       wxFONTWEIGHT_NORMAL, FALSE, wxString( _T ( "Arial" ) ) );
    pMFont = FontMgr::Get().FindOrCreateFont( dlg_font_size, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD,
                                                      FALSE, wxString( _T ( "Arial" ) ) );
    pLFont = FontMgr::Get().FindOrCreateFont( dlg_font_size+1, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD,
                                                      FALSE, wxString( _T ( "Arial" ) ) );

    pblack_1 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFD" ) ), wxMax(1,(int)(m_tcwin_scaler+0.5)),
					      wxPENSTYLE_SOLID );
    pblack_2 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFD" ) ), wxMax(2,(int)(2*m_tcwin_scaler+0.5)),
					      wxPENSTYLE_SOLID );
    pblack_3 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UWHIT" ) ), wxMax(1,(int)(m_tcwin_scaler+0.5)),
                                                                          wxPENSTYLE_SOLID );
    pred_2 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFR" ) ), wxMax(4,(int)(4*m_tcwin_scaler+0.5)),
                                                                        wxPENSTYLE_SOLID );
    pltgray = wxTheBrushList->FindOrCreateBrush( GetGlobalColor( _T ( "UIBCK" ) ),
                                                                               wxBRUSHSTYLE_SOLID );
    pltgray2 = wxTheBrushList->FindOrCreateBrush( GetGlobalColor( _T ( "DILG1" ) ),
                                                                                wxBRUSHSTYLE_SOLID );

    DimeControl( this );

    //  Fill in some static text control information

    //  Tidi station information
    m_ptextctrl->Clear();

    wxString locn( pIDX->IDX_station_name, wxConvUTF8 );
    wxString locna, locnb;
    if( locn.Contains( wxString( _T ( "," ) ) ) ) {
        locna = locn.BeforeFirst( ',' );
        locnb = locn.AfterFirst( ',' );
    } else {
        locna = locn;
        locnb.Empty();
    }

    // write the first line
    wxTextAttr style;
    style.SetFont( *pLFont );
    m_ptextctrl->SetDefaultStyle( style );

    m_ptextctrl->AppendText( locna );
    m_ptextctrl->AppendText(_T("\n"));

    style.SetFont( *pSMFont );
    m_ptextctrl->SetDefaultStyle( style );

    if( !locnb.IsEmpty() )
        m_ptextctrl->AppendText( locnb );
    m_ptextctrl->AppendText(_T("\n"));


    //Reference to the master station
    if(( 't' == pIDX->IDX_type ) || ( 'c' == pIDX->IDX_type )) {
        wxString mref( pIDX->IDX_reference_name, wxConvUTF8 );
        mref.Prepend(_T(" "));

        m_ptextctrl->AppendText( _( "Reference Station :" ) );
        m_ptextctrl->AppendText(_T("\n"));

        m_ptextctrl->AppendText( mref );
        m_ptextctrl->AppendText(_T("\n"));

    }
    else {
        m_ptextctrl->AppendText(_T("\n"));
    }

    //      Show the data source
    wxString dsource( pIDX->source_ident, wxConvUTF8 );
    dsource.Prepend(_T(" "));

    m_ptextctrl->AppendText( _( "Data Source :" ) );
    m_ptextctrl->AppendText(_T("\n"));

    m_ptextctrl->AppendText( dsource );

    m_ptextctrl->ShowPosition( 0 );
}
Exemplo n.º 10
0
LTBOOL CMenuPlayer::Init()
{
	m_MenuID = MENU_ID_PLAYER;
	s_pSklMenu = this;

	if (!CBaseMenu::Init()) return LTFALSE;

	int nNameWidth = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"NameWidth");
	int nLevelWidth = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"LevelWidth");
	int nUpgradeWidth = s_Size.x - ( (m_Indent.x * 2) + nNameWidth + nLevelWidth);


	LTVector vColor = g_pLayoutMgr->GetMenuCustomVector(m_MenuID,"HighlightColor");
	uint8 nA = 255;
	uint8 nR = (uint8)vColor.x;
	uint8 nG = (uint8)vColor.y;
	uint8 nB = (uint8)vColor.z;

	skillHighlightColor= SET_ARGB(nA,nR,nG,nB);


	uint8 nSmallerFont = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"SmallerFontSize");

	SetTitle(IDS_TITLE_SUMMARY);

	LTIntPt	popupSize = g_pLayoutMgr->GetMenuCustomPoint(m_MenuID,"PopupSize");
	m_Popup.Init(s_Frame,s_FrameTip,popupSize);
	m_Popup.m_bWaitForUpdate = LTFALSE;
	LTIntPt offset = m_Indent;
	offset.y = 8;

	CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_TitleFontFace);
	m_Name.Create("name",LTNULL,LTNULL,pFont,m_TitleFontSize,LTNULL);
	m_Name.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Name.Enable(LTFALSE);
	m_Popup.AddControl(&m_Name,offset);
	offset.y += (m_Name.GetHeight() + 4);


	pFont = g_pInterfaceResMgr->GetFont(m_FontFace);
	m_Level.Create("level",LTNULL,LTNULL,pFont,m_FontSize,LTNULL);
	m_Level.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Level.Enable(LTFALSE);
	m_Popup.AddControl(&m_Level,offset);
	offset.y += (m_Level.GetHeight() + 12);

	m_Header.Create(LTNULL,LTNULL,pFont,m_FontSize, LTNULL);
	m_Header.AddColumn(" ",nNameWidth);
	m_Header.AddColumn(LoadTempString(IDS_CURRENT),60);
	m_Header.AddColumn(LoadTempString(IDS_UPGRADE),60);
	m_Header.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Header.Enable(LTFALSE);
	m_Popup.AddControl(&m_Header,offset);
	offset.y += (m_Header.GetHeight() + 2);


	for (uint8 m = 0; m < kMaxModifiers; ++m)
	{
		m_Mods[m].Create(LTNULL,LTNULL,pFont,m_FontSize,LTNULL);
		m_Mods[m].AddColumn(" ",nNameWidth);
		m_Mods[m].AddColumn("100",60);
		m_Mods[m].AddColumn("100",60);
		m_Mods[m].SetColors(skillHighlightColor,m_NonSelectedColor,m_DisabledColor);
		m_Mods[m].Enable(LTTRUE);
		m_Popup.AddControl(&m_Mods[m],offset);
		offset.y += (m_Mods[m].GetHeight() + 2);

	}
	offset.y += 8;

	m_Upgrade.Create("Upgrade",MC_UPGRADE,IDS_HELP_UPGRADE,pFont,m_FontSize,this);
	m_Upgrade.SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);
	m_Popup.AddControl(&m_Upgrade,offset);
	offset.y += (m_Upgrade.GetHeight() + 4);

	m_Points.Create("avail",LTNULL,LTNULL,pFont,m_FontSize,LTNULL);
	m_Points.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Points.SetFont(LTNULL,nSmallerFont);
	m_Points.Enable(LTFALSE);
	m_Popup.AddControl(&m_Points,offset);

	uint8 nHelpFont = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"HelpFontSize");
	offset = g_pLayoutMgr->GetMenuCustomPoint(m_MenuID,"HelpOffset");
	uint16 nWidth = 600 - 2* offset.x;
	if (!nHelpFont)
		nHelpFont = m_FontSize;
	m_ModDesc.Create("description",LTNULL,LTNULL,pFont,nHelpFont,LTNULL);
	m_ModDesc.SetColors(m_SelectedColor,m_SelectedColor,m_SelectedColor);
	m_ModDesc.SetFixedWidth(nWidth);
	m_ModDesc.Enable(LTFALSE);
	m_Popup.AddControl(&m_ModDesc,offset);



	int nPopupPos = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"PopupPos");
	m_Popup.SetBasePos(LTIntPt(0,nPopupPos));

	g_pInterfaceMgr->GetMenuMgr()->RegisterCommand(COMMAND_ID_STATUS,MENU_ID_PLAYER);

	//Rank control
	m_pRank = AddColumnCtrl();
	m_pRank->AddColumn(LoadTempString(IDS_RANK),nNameWidth);
	m_pRank->AddColumn("Novice",nNameWidth);

	//Total points control
	m_pTotal = AddColumnCtrl();
	m_pTotal->AddColumn(LoadTempString(IDS_SCORE),nNameWidth);
	m_pTotal->AddColumn("0",nNameWidth);

	//Avail points control
	m_pAvail = AddColumnCtrl();
	m_pAvail->AddColumn(LoadTempString(IDS_SKILL_PTS),nNameWidth);
	m_pAvail->AddColumn("0",nNameWidth);

	AddControl(" ",0,LTTRUE);


//	CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_FontFace);
	for (uint8 i = 0; i < kNumSkills; i++)
	{
		eSkill skl = (eSkill)i;
		if (g_pSkillsButeMgr->IsAvailable(skl) )
		{
			m_pSkills[i] = debug_new(CSkillCtrl);
			m_pSkills[i]->Create(skl,(MC_CUSTOM+i),pFont,m_FontSize,this,nNameWidth);
			m_List.AddControl(m_pSkills[i]);
		}

	}
	

	return LTTRUE;
}
Exemplo n.º 11
0
bool wxFrame::Create(wxWindow *parent,
                     wxWindowID id,
                     const wxString& title,
                     const wxPoint& pos,
                     const wxSize& size,
                     long style,
                     const wxString& name)
{
    if( !wxTopLevelWindow::Create( parent, id, title, pos, size, style,
                                   name ) )
        return false;

    m_backgroundColour =
        wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
    m_foregroundColour = *wxBLACK;
    m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);

    int x = pos.x, y = pos.y;
    int width = size.x, height = size.y;

    // Set reasonable values for position and size if defaults have been
    // requested
    //
    // MB TODO: something better than these arbitrary values ?
    // VZ       should use X resources for this...
    if ( width == -1 )
        width = 400;
    if ( height == -1 )
        height = 400;

    int displayW, displayH;
    wxDisplaySize( &displayW, &displayH );

    if ( x == -1 )
    {
        x = (displayW - width) / 2;
        if (x < 10) x = 10;
    }
    if ( y == -1 )
    {
        y = (displayH - height) / 2;
        if (y < 10) y = 10;
    }

    SetTitle( title );

    wxLogTrace(wxTRACE_Messages,
               "Created frame (0x%p) with work area 0x%p and client "
               "area 0x%p", m_mainWidget, m_workArea, m_clientArea);

    XtAddEventHandler((Widget) m_clientArea, ExposureMask,False,
        wxUniversalRepaintProc, (XtPointer) this);

    if (x > -1)
        XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL);
    if (y > -1)
        XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL);
    if (width > -1)
        XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL);
    if (height > -1)
        XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL);

    ChangeFont(false);

    ChangeBackgroundColour();

    PreResize();

    wxSize newSize(width, height);
    wxSizeEvent sizeEvent(newSize, GetId());
    sizeEvent.SetEventObject(this);

    GetEventHandler()->ProcessEvent(sizeEvent);

    return true;
}
Exemplo n.º 12
0
bool wxTopLevelWindowX11::Create(wxWindow *parent,
                                 wxWindowID id,
                                 const wxString& title,
                                 const wxPoint& pos,
                                 const wxSize& size,
                                 long style,
                                 const wxString& name)
{
    // init our fields
    Init();

    m_windowStyle = style;
    m_parent = parent;

    SetName(name);

    m_windowId = id == wxID_ANY ? NewControlId() : id;

    if (parent)
        parent->AddChild(this);

    wxTopLevelWindows.Append(this);

    Display *xdisplay = wxGlobalDisplay();
    int xscreen = DefaultScreen( xdisplay );
    Visual *xvisual = DefaultVisual( xdisplay, xscreen );
    Window xparent = RootWindow( xdisplay, xscreen );
    Colormap cm = DefaultColormap( xdisplay, xscreen );

    if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
        m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
    else
        m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
    m_backgroundColour.CalcPixel( (WXColormap) cm );
    m_hasBgCol = true;

    m_x = pos.x;
    if (m_x < -1)
        m_x = 10;

    m_y = pos.y;
    if (m_y < 0)
        m_y = 10;

    m_width = size.x;
    if (m_width < 0)
        m_width = 500;

    m_height = size.y;
    if (m_height < 0)
        m_height = 380;

#if !wxUSE_NANOX
    XSetWindowAttributes xattributes;

    long xattributes_mask =
        CWBorderPixel | CWBackPixel;

    xattributes.background_pixel = m_backgroundColour.GetPixel();
    xattributes.border_pixel = BlackPixel( xdisplay, xscreen );

    if (HasFlag( wxNO_BORDER ))
    {
        xattributes_mask |= CWOverrideRedirect;
        xattributes.override_redirect = True;
    }

    if (!HasFlag( wxFULL_REPAINT_ON_RESIZE ))
    {
        xattributes_mask |= CWBitGravity;
        xattributes.bit_gravity = NorthWestGravity;
    }

    xattributes_mask |= CWEventMask;
    xattributes.event_mask =
        ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
        ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
        KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
        PropertyChangeMask;

    Window xwindow = XCreateWindow( xdisplay, xparent, m_x, m_y, m_width, m_height,
                                    0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
#else
    long backColor, foreColor;
    backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
    foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());

    Window xwindow = XCreateWindowWithColor( xdisplay, xparent, m_x, m_y, m_width, m_height,
                                    0, 0, InputOutput, xvisual, backColor, foreColor);
#endif

    m_mainWindow = (WXWindow) xwindow;
    m_clientWindow = (WXWindow) xwindow;
    wxAddWindowToTable( xwindow, (wxWindow*) this );

#if wxUSE_NANOX
    XSelectInput( xdisplay, xwindow,
                  GR_EVENT_MASK_CLOSE_REQ |
                  ExposureMask |
                  KeyPressMask |
                  KeyReleaseMask |
                  ButtonPressMask |
                  ButtonReleaseMask |
                  ButtonMotionMask |
                  EnterWindowMask |
                  LeaveWindowMask |
                  PointerMotionMask |
                  KeymapStateMask |
                  FocusChangeMask |
                  ColormapChangeMask |
                  StructureNotifyMask |
                  PropertyChangeMask
                  );
#endif

    // Set background to None which will prevent X11 from clearing the
    // background completely.
    XSetWindowBackgroundPixmap( xdisplay, xwindow, None );

#if !wxUSE_NANOX
    if (HasFlag( wxSTAY_ON_TOP ))
    {
        Window xroot = RootWindow( xdisplay, xscreen );
        XSetTransientForHint( xdisplay, xwindow, xroot );
    }
    else
    {
       if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
       {
            if (GetParent() && GetParent()->X11GetMainWindow())
            {
                Window xparentwindow = (Window) GetParent()->X11GetMainWindow();
                XSetTransientForHint( xdisplay, xwindow, xparentwindow );
            }
        }
    }

    XSizeHints size_hints;
    size_hints.flags = PSize | PPosition | PWinGravity;
    size_hints.x = m_x;
    size_hints.y = m_y;
    size_hints.width = m_width;
    size_hints.height = m_height;
    size_hints.win_gravity = NorthWestGravity;
    XSetWMNormalHints( xdisplay, xwindow, &size_hints);

    XWMHints wm_hints;
    wm_hints.flags = InputHint | StateHint;
    if (GetParent())
    {
        wm_hints.flags |= WindowGroupHint;
        wm_hints.window_group = (Window) GetParent()->X11GetMainWindow();
    }
    wm_hints.input = True;
    wm_hints.initial_state = NormalState;
    XSetWMHints( xdisplay, xwindow, &wm_hints);

    Atom wm_protocols[2];
    wm_protocols[0] = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False );
    wm_protocols[1] = XInternAtom( xdisplay, "WM_TAKE_FOCUS", False );
    XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2);

#endif

    wxSetWMDecorations( xwindow, style);

    SetTitle(title);

    return true;
}
Exemplo n.º 13
0
void QuickView::SetFocus()
{
	Panel::SetFocus();
	SetTitle();
}
Exemplo n.º 14
0
RecipeEditor::RecipeEditor(const BRect &frame, const BMessenger &msgr,
						const int32 &number, const char *category)
 :	BWindow(frame,"Add Recipe",B_FLOATING_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
 			B_ASYNCHRONOUS_CONTROLS),
 	fMessenger(msgr),
 	fNumber(number),
 	fCategory(category)
{
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('Q', B_COMMAND_KEY, new BMessage(M_QUIT_APP));
	
	BView *back = new BView(Bounds(),"back",B_FOLLOW_ALL, B_WILL_DRAW);
	back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(back);
	
	fCategories = new BMenu("Categories");
	CppSQLite3Query query = DBQuery("select category from categories order by category;",
									"RecipeEditor:get categories");
	while(!query.eof())
	{
		BString cat(DeescapeIllegalCharacters(query.getStringField(0)));
		BMessage *menumsg = new BMessage(M_CATEGORY_CHANGED);
		menumsg->AddString("name",cat);
		fCategories->AddItem(new BMenuItem(cat.String(),menumsg));
		query.nextRow();
	}
	fCategories->SetRadioMode(true);
	fCategories->SetLabelFromMarked(true);
	if(fCategories->CountItems()>0)
		fCategories->ItemAt(0)->SetMarked(true);
	BRect r(10,10,10 + fCategories->MaxContentWidth(),11);
	BMenuField *field = new BMenuField(r,"field","Category",fCategories,
										B_FOLLOW_LEFT | B_FOLLOW_TOP,
										B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
	back->AddChild(field);
	field->ResizeToPreferred();
	r = field->Frame();
	
	if(category)
	{
		BMenuItem *marked = fCategories->FindItem(category);
		if(marked)
			marked->SetMarked(true);
	}
	else
	{
		BMenuItem *marked = fCategories->ItemAt(0L);
		if(marked)
			marked->SetMarked(true);
	}
	
	r.OffsetBy(0,r.Height() + 10);
	fNameBox = new AutoTextControl(r,"namebox","Name: ",NULL,NULL,
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
									B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
									B_NAVIGABLE_JUMP);
	fNameBox->SetEscapeCancel(true);
	fNameBox->SetDivider(be_plain_font->StringWidth("Name ") + 5);
	back->AddChild(fNameBox);
	fNameBox->ResizeToPreferred();
	r = fNameBox->Frame();
	r.right = Bounds().right - 10;
	fNameBox->ResizeTo(r.Width(), r.Height());
	
	r.OffsetBy(0,r.Height() + 10);
	BStringView *label = new BStringView(r,"inglabel","Ingredients:");
	back->AddChild(label);
	
	r.OffsetBy(0,r.Height() + 10);
	r.bottom = r.top + 100;
	r.right -= B_V_SCROLL_BAR_WIDTH;
	
	BRect textrect = r.OffsetToCopy(0,0);
	textrect.InsetBy(10,10);
	fIngredientBox = new BTextView(r, "ingredients", textrect, B_FOLLOW_ALL,
									B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
									B_NAVIGABLE_JUMP);
	fIngredientBox->SetDoesUndo(true);
	
	
	BScrollView *ingredscroll = new BScrollView("ingredients_scroller",fIngredientBox,
										B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,0,false, true);
	back->AddChild(ingredscroll);
	
	r = ingredscroll->Frame();
	
	label = new BStringView(BRect(10,10,11,11),"dirlabel","Directions:");
	label->ResizeToPreferred();
	label->MoveTo(10, r.bottom + 10);
	back->AddChild(label);
	
	r.OffsetBy(0,r.Height() + 20 + label->Frame().Height());
	r.right -= B_V_SCROLL_BAR_WIDTH;
	textrect = r.OffsetToCopy(0,0);
	textrect.InsetBy(10,10);
	fDirectionsBox = new BTextView(r, "directions", textrect, B_FOLLOW_ALL,
									B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
									B_NAVIGABLE_JUMP);
	fDirectionsBox->SetDoesUndo(true);
	
	BScrollView *dirscroll = new BScrollView("directions_scroller",fDirectionsBox,
										B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,0,false, true);
	back->AddChild(dirscroll);
	
	
	fOK = new BButton(BRect(10,10,11,11),"ok","Cancel", new BMessage(M_ADD_RECIPE),
							B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
	fOK->ResizeToPreferred();
	fOK->SetLabel("OK");
	fOK->MoveTo(Bounds().right - fOK->Bounds().Width() - 10,
				Bounds().bottom - fOK->Bounds().Height() - 10);
	r = fOK->Frame();
	back->AddChild(fOK);
	
	r.OffsetBy(-r.Width() - 10, 0);
	fCancel = new BButton(r,"cancel","Cancel",new BMessage(B_QUIT_REQUESTED),
						B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
	back->AddChild(fCancel);
	
	field->MakeFocus(true);
	
	ResizeTo(Bounds().Width(),
			fDirectionsBox->Parent()->Frame().bottom + 20 + fOK->Bounds().Height());
	
	dirscroll->SetResizingMode(B_FOLLOW_ALL);
	
	// This is the part that's different for editing a recipe as opposed to
	// just adding one to the database
	if(number >= 0 && category)
	{
		SetTitle("Edit Recipe");
		BString name, ingredients, directions;
		if(GetRecipe(number,category,name,ingredients,directions))
		{
			BMenuItem *item = fCategories->FindItem(category);
			if(item)
				item->SetMarked(true);
			
			fNameBox->SetText(name.String());
			fIngredientBox->SetText(ingredients.String());
			fDirectionsBox->SetText(directions.String());
			fOK->SetMessage(new BMessage(M_EDIT_RECIPE));
		}
	}
	
	AddShortcut(B_ENTER, B_COMMAND_KEY, new BMessage(fOK->Command()));
}
Exemplo n.º 15
0
CCheckBox::CCheckBox(const int vx,const int vy,const int vw,const int vh,CWnd* vowner,const PCHAR title,const int vcommand,const BOOLEAN vchecked)
:CWnd(NULL,vx,vy,vw,vh,vowner,vcommand),checked(vchecked)
{
	SetTitle(title);
}
void 
nsMediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
                                       const char* const* aFormatNames,
                                       PRInt32 aWidth, PRInt32 aHeight,
                                       const nsAString& aStatus)
{
  nsXPIDLString fileStr;
  if (mDocumentURI) {
    nsCAutoString fileName;
    nsCOMPtr<nsIURL> url = do_QueryInterface(mDocumentURI);
    if (url)
      url->GetFileName(fileName);

    nsCAutoString docCharset;

    // Now that the charset is set in |StartDocumentLoad| to the charset of
    // the document viewer instead of a bogus value ("ISO-8859-1" set in
    // |nsDocument|'s ctor), the priority is given to the current charset. 
    // This is necessary to deal with a media document being opened in a new 
    // window or a new tab, in which case |originCharset| of |nsIURI| is not 
    // reliable.
    if (mCharacterSetSource != kCharsetUninitialized) {  
      docCharset = mCharacterSet;
    }
    else {  
      // resort to |originCharset|
      mDocumentURI->GetOriginCharset(docCharset);
      SetDocumentCharacterSet(docCharset);
    }
    if (!fileName.IsEmpty()) {
      nsresult rv;
      nsCOMPtr<nsITextToSubURI> textToSubURI = 
        do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
      if (NS_SUCCEEDED(rv))
        // UnEscapeURIForUI always succeeds
        textToSubURI->UnEscapeURIForUI(docCharset, fileName, fileStr);
      else 
        CopyUTF8toUTF16(fileName, fileStr);
    }
  }


  NS_ConvertASCIItoUTF16 typeStr(aTypeStr);
  nsXPIDLString title;

  if (mStringBundle) {
    // if we got a valid size (not all media have a size)
    if (aWidth != 0 && aHeight != 0) {
      nsAutoString widthStr;
      nsAutoString heightStr;
      widthStr.AppendInt(aWidth);
      heightStr.AppendInt(aHeight);
      // If we got a filename, display it
      if (!fileStr.IsEmpty()) {
        const PRUnichar *formatStrings[4]  = {fileStr.get(), typeStr.get(), 
          widthStr.get(), heightStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDimAndFile]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 4,
                                            getter_Copies(title));
      } 
      else {
        const PRUnichar *formatStrings[3]  = {typeStr.get(), widthStr.get(), 
          heightStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDim]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 3,
                                            getter_Copies(title));
      }
    } 
    else {
    // If we got a filename, display it
      if (!fileStr.IsEmpty()) {
        const PRUnichar *formatStrings[2] = {fileStr.get(), typeStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithFile]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
                                            getter_Copies(title));
      }
      else {
        const PRUnichar *formatStrings[1] = {typeStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithNoInfo]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 1,
                                            getter_Copies(title));
      }
    }
  } 

  // set it on the document
  if (aStatus.IsEmpty()) {
    SetTitle(title);
  }
  else {
    nsXPIDLString titleWithStatus;
    const nsPromiseFlatString& status = PromiseFlatString(aStatus);
    const PRUnichar *formatStrings[2] = {title.get(), status.get()};
    NS_NAMED_LITERAL_STRING(fmtName, "TitleWithStatus");
    mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
                                        getter_Copies(titleWithStatus));
    SetTitle(titleWithStatus);
  }
}
Exemplo n.º 17
0
CGroupBox::CGroupBox(const int vx,const int vy,const int vw,const int vh,const PCHAR vtitle,CWnd* vowner)
:CWnd(NULL,vx,vy,vw,vh,vowner)
{
	SetTitle(vtitle);
	canfocus=FALSE;
}
Exemplo n.º 18
0
frmBackupServer::frmBackupServer(frmMain *form, pgObject *obj) : ExternProcessDialog(form)
{
	object = obj;

	wxWindowBase::SetFont(settings->GetSystemFont());
	LoadResource(form, wxT("frmBackupServer"));
	RestorePosition();

	SetTitle(object->GetTranslatedMessage(BACKUPSERVERTITLE));

	pgServer *server = (pgServer *)object;
	if (server->GetConnection()->EdbMinimumVersion(8, 0))
		backupExecutable = edbBackupAllExecutable;
	else if (server->GetConnection()->GetIsGreenplum())
		backupExecutable = gpBackupAllExecutable;
	else
		backupExecutable = pgBackupAllExecutable;

	wxString val;
	settings->Read(wxT("frmBackupServer/LastFile"), &val, wxEmptyString);
	txtFilename->SetValue(val);

	bool roles_supported = pgAppMinimumVersion(backupExecutable, 8, 4) && server->GetConnection()->BackendMinimumVersion(8, 1);
	cbRolename->Enable(roles_supported);

	if (roles_supported)
	{
		// Collect the available rolenames
		pgSetIterator set(server->GetConnection(),
		                  wxT("SELECT DISTINCT rolname\n")
		                  wxT("FROM pg_roles db\n")
		                  wxT("ORDER BY rolname"));

		cbRolename->Append(wxEmptyString);

		while(set.RowsLeft())
			cbRolename->Append(set.GetVal(wxT("rolname")));

		cbRolename->SetValue(server->GetRolename());
	}

	if (!server->GetPasswordIsStored())
		environment.Add(wxT("PGPASSWORD="******"PGSSLMODE=") + server->GetConnection()->GetSslModeName());

	// Icon
	SetIcon(*backup_png_ico);

	txtMessages = CTRL_TEXT("txtMessages");
	txtMessages->SetMaxLength(0L);
	btnOK->Disable();

	if (!pgAppMinimumVersion(backupExecutable, 9, 1))
	{
		chkForceQuoteForIdent->Disable();
	}

	wxCommandEvent ev;
	OnChange(ev);
}
Exemplo n.º 19
0
void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane)
{
    m_pane_window = pane.window;
    m_pane_window->Reparent(this);

    wxAuiPaneInfo contained_pane = pane;
    contained_pane.Dock().Center().Show().
                    CaptionVisible(false).
                    PaneBorder(false).
                    Layer(0).Row(0).Position(0);

    // Carry over the minimum size
    wxSize pane_min_size = pane.window->GetMinSize();

    // if the frame window's max size is greater than the min size
    // then set the max size to the min size as well
    wxSize cur_max_size = GetMaxSize();
    if (cur_max_size.IsFullySpecified() &&
          (cur_max_size.x < pane.min_size.x ||
           cur_max_size.y < pane.min_size.y)
       )
    {
        SetMaxSize(pane_min_size);
    }

    SetMinSize(pane.window->GetMinSize());

    m_mgr.AddPane(m_pane_window, contained_pane);
    m_mgr.Update();

    if (pane.min_size.IsFullySpecified())
    {
        // because SetSizeHints() calls Fit() too (which sets the window
        // size to its minimum allowed), we keep the size before calling
        // SetSizeHints() and reset it afterwards...
        wxSize tmp = GetSize();
        GetSizer()->SetSizeHints(this);
        SetSize(tmp);
    }

    SetTitle(pane.caption);

    if (pane.floating_size != wxDefaultSize)
    {
        SetSize(pane.floating_size);
    }
    else
    {
        wxSize size = pane.best_size;
        if (size == wxDefaultSize)
            size = pane.min_size;
        if (size == wxDefaultSize)
            size = m_pane_window->GetSize();
        if (m_owner_mgr && pane.HasGripper())
        {
            if (pane.HasGripperTop())
                size.y += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE);
            else
                size.x += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE);
        }

        SetClientSize(size);
    }

    if (pane.IsFixed())
    {
        SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER);
    }
}
Exemplo n.º 20
0
  /*----------------------------------------------------------------------
    SaveAsDlgWX create the SaveAs dialog 
    params:
    + parent : parent window
    + pathname : document location
    ----------------------------------------------------------------------*/
SaveAsDlgWX::SaveAsDlgWX( int ref, wxWindow *parent, const wxString & pathname,
                          int doc, ThotBool saveImgs, ThotBool saveRes,
                          ThotBool checkTemplate) :
  AmayaDialog( parent, ref )
{
  wxNotebook *p_notebook;
  wxWindow   *p_obj;
  wxPanel    *p_page;
  int         doc_type;
  int         page_id = 0;
  
  doc_type = DocumentTypes[doc];
  MyRef = ref;
  MysaveImgs = saveImgs;
  MysaveRes = saveRes;
  // waiting for a return
  Waiting = 1;

  wxXmlResource::Get()->LoadDialog(this, parent, wxT("SaveAsDlgWX"));
  wxString wx_title = TtaConvMessageToWX( TtaGetMessage (AMAYA, AM_SAVE_AS) );
  SetTitle( wx_title );
  p_notebook = XRCCTRL(*this, "wxID_NOTEBOOK", wxNotebook);
  p_page = (wxPanel *)FindWindow(wxXmlResource::GetXRCID( _T("wxID_PAGE_EXTRA")));
  while (page_id < (int) p_notebook->GetPageCount() )
    {
      if ( p_page == p_notebook->GetPage(page_id))
        {
          if ( doc_type == docSource || doc_type == docCSS ||
               doc_type == docText || doc_type == docImage)
            p_notebook->DeletePage(page_id);
          else
            p_notebook->SetPageText (page_id,
                                     TtaConvMessageToWX(TtaGetMessage(AMAYA, AM_EXTENSION)));
        }
      else
        p_notebook->SetPageText (page_id,
                                 TtaConvMessageToWX(TtaGetMessage(AMAYA, AM_QUICK_SAVE)));
        page_id++;
    }

  // Document format radio box
  if ( doc_type == docSource || doc_type == docCSS ||  doc_type == docText ||  doc_type == docImage)
    {
      // now hide unused field
      p_obj = XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      p_obj = XRCCTRL(*this, "wxID_OPTIONS", wxStaticText);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      p_obj = XRCCTRL(*this, "wxID_CPY_IMAGES_CHK", wxCheckBox);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      p_obj = XRCCTRL(*this, "wxID_CPY_CSS_CHK", wxCheckBox);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      p_obj = XRCCTRL(*this, "wxID_TRANSFORM_URLS_CHK", wxCheckBox);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      p_obj = XRCCTRL(*this, "wxID_REMOVE_TEMPLATE", wxCheckBox);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      p_obj = XRCCTRL(*this, "wxID_STATICLINE", wxStaticLine);
      p_obj->GetContainingSizer()->Show(p_obj, FALSE);
      if ( doc_type == docSource)
        {
          p_obj = XRCCTRL(*this, "wxID_CHARSET", wxStaticText);
          p_obj->GetContainingSizer()->Show(p_obj, FALSE);
          p_obj = XRCCTRL(*this, "wxID_CHARSET_CB", wxComboBox);
          p_obj->GetContainingSizer()->Show(p_obj, FALSE);
        }
      GetSizer()->SetSizeHints( this );
      // no image will be saved
      MysaveImgs = FALSE;
      MysaveRes = FALSE;
    }
  else
    {
      XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetLabel(TtaConvMessageToWX( TtaGetMessage (LIB, TMSG_DOCUMENT_FORMAT) ));
      XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetString(0, TtaConvMessageToWX( "HTML"  ) );
      XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetString(1, TtaConvMessageToWX( "XML" ));
      XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetString(2, TtaConvMessageToWX( TtaGetMessage (AMAYA, AM_TEXT) ));
      if (DocumentMeta[doc] && DocumentMeta[doc]->xmlformat)
        XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetSelection(1);
      else if (doc_type == docMath || doc_type == docSVG || doc_type == docXml)
        XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetSelection(1);
      else if (doc_type == docHTML)
        XRCCTRL(*this, "wxID_DOC_FORMAT", wxRadioBox)->SetSelection(0);

      // Options check box
      // check templates
      if (checkTemplate)
        XRCCTRL(*this, "wxID_REMOVE_TEMPLATE", wxCheckBox)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_REMOVE_XTIGER) ));
      else
        {
          p_obj = XRCCTRL(*this, "wxID_REMOVE_TEMPLATE", wxCheckBox);
          p_obj->GetContainingSizer()->Show(p_obj, FALSE);
        }
      XRCCTRL(*this, "wxID_OPTIONS", wxStaticText)->SetLabel(TtaConvMessageToWX( TtaGetMessage(LIB, TMSG_OPTIONS) ));
      XRCCTRL(*this, "wxID_CPY_IMAGES_CHK", wxCheckBox)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_BCOPY_IMAGES) ));
      XRCCTRL(*this, "wxID_CPY_CSS_CHK", wxCheckBox)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_BCOPY_CSS) ));
      XRCCTRL(*this, "wxID_TRANSFORM_URLS_CHK", wxCheckBox)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_BTRANSFORM_URL) ));
      CopyImages = saveImgs;
      XRCCTRL(*this, "wxID_CPY_IMAGES_CHK", wxCheckBox)->SetValue(CopyImages);
      CopyResources = saveRes;
      XRCCTRL(*this, "wxID_CPY_CSS_CHK", wxCheckBox)->SetValue(CopyResources);
      TtaGetEnvBoolean ("TRANSFORM_URL", &UpdateURLs);
      XRCCTRL(*this, "wxID_TRANSFORM_URLS_CHK", wxCheckBox)->SetValue(UpdateURLs);
      RemoveTemplate = FALSE;
      // Image directory
      XRCCTRL(*this, "wxID_IMG_LOCATION", wxStaticText)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_WHERE_IMAGE) ));
      if (saveImgs)
        {
          int end_pos = pathname.Find(DIR_SEP, true);
          wxString dir_value = pathname.SubString(0, end_pos);
          XRCCTRL(*this, "wxID_IMG_LOCATION_CTRL", wxTextCtrl)->SetValue(dir_value);
          XRCCTRL(*this, "wxID_IMG_BROWSE", wxBitmapButton)->SetToolTip(TtaConvMessageToWX(TtaGetMessage(LIB,TMSG_SEL)));
        }
      else
        XRCCTRL(*this, "wxID_IMG_LOCATION_CTRL", wxTextCtrl)->SetEditable (false);

      // CSS directory
      XRCCTRL(*this, "wxID_CSS_LOCATION", wxStaticText)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_WHERE_RESOURCE) ));
      XRCCTRL(*this, "wxID_CSS_LOCATION_CTRL", wxTextCtrl)->SetEditable (false);
    }

  // Document location
  XRCCTRL(*this, "wxID_DOC_LOCATION", wxStaticText)->SetLabel(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_DOC_LOCATION) ));
  XRCCTRL(*this, "wxID_DOC_LOCATION_CTRL", wxTextCtrl)->SetValue(pathname);

  // Charset  
  wxString wx_label = TtaConvMessageToWX( "Charset :" );
  wxString wx_ascii = TtaConvMessageToWX( "us-ascii" );
  wxString wx_iso_8859_1 = TtaConvMessageToWX( "iso-8859-1" );
  wxString wx_utf8 = TtaConvMessageToWX( "UTF-8" );
  XRCCTRL(*this, "wxID_CHARSET", wxStaticText)->SetLabel(wx_label);

  if (!strcmp (UserCharset, "us-ascii"))
    {
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "us-ascii" ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "iso-8859-1" ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "UTF-8" ) );
    }
  else if (!strcmp (UserCharset, "iso-8859-1"))
    {
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "iso-8859-1" ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "us-ascii" ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "UTF-8" ) );
    }
  else
    {
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( UserCharset ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "UTF-8" ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "us-ascii" ) );
      XRCCTRL(*this, "wxID_CHARSET_CB",
              wxComboBox)->Append ( TtaConvMessageToWX( "iso-8859-1" ) );
    }
  XRCCTRL(*this, "wxID_CHARSET_CB",
          wxComboBox)->SetSelection (0);

  // Mime Type
  wx_label = TtaConvMessageToWX( " Mime Type :" );
  XRCCTRL(*this, "wxID_MIME_TYPE", wxStaticText)->SetLabel( wx_label );

  wxString wx_mime_type = TtaConvMessageToWX( UserMimeType );
  if (doc_type == docImage)
    {
      XRCCTRL(*this, "wxID_MIME_TYPE_CB",
              wxComboBox)->Append( wx_mime_type );
      if (strcmp (UserMimeType, "image/png"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "image/png" ) );
      if (strcmp (UserMimeType, "image/jpeg"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "image/jpeg" ) );
      if (strcmp (UserMimeType, "image/gif"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "image/gif" ) );
      if (strcmp (UserMimeType, "image/x-bitmap"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "image/x-bitmap" ) );
      if (strcmp (UserMimeType, "image/x-xpicmap"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "image/x-xpicmap" ) );
    }
  else if (doc_type == docSVG)
    {
      XRCCTRL(*this, "wxID_MIME_TYPE_CB",
              wxComboBox)->Append( wx_mime_type );
      if (strcmp (UserMimeType, AM_SVG_MIME_TYPE))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( AM_SVG_MIME_TYPE ) );
      if (strcmp (UserMimeType, "application/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "application/xml" ) );
      if (strcmp (UserMimeType, "text/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/xml" ) );
    }
  else if (doc_type == docMath)
    {
      XRCCTRL(*this, "wxID_MIME_TYPE_CB",
              wxComboBox)->Append( wx_mime_type );
      if (strcmp (UserMimeType, AM_MATHML_MIME_TYPE))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( AM_MATHML_MIME_TYPE ) );
      if (strcmp (UserMimeType, "application/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "application/xml" ) );
      if (strcmp (UserMimeType, "text/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/xml" ) );
    }
  else if (doc_type == docHTML && DocumentMeta[doc] &&
           DocumentMeta[doc]->xmlformat)
    {
      XRCCTRL(*this, "wxID_MIME_TYPE_CB",
              wxComboBox)->Append( wx_mime_type );
      if (strcmp (UserMimeType, AM_XHTML_MIME_TYPE))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( AM_XHTML_MIME_TYPE ) );
      if (strcmp (UserMimeType, "text/html"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/html" ) );
      if (strcmp (UserMimeType, "application/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "application/xml" ) );
      if (strcmp (UserMimeType, "text/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/xml" ) );
    }
  else
    {
      XRCCTRL(*this, "wxID_MIME_TYPE_CB",
              wxComboBox)->Append( wx_mime_type );
      if (strcmp (UserMimeType, "text/html"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/html" ) );
      if (strcmp (UserMimeType, AM_XHTML_MIME_TYPE))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( AM_XHTML_MIME_TYPE ) );
      if (strcmp (UserMimeType, "application/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "application/xml" ) );
      if (strcmp (UserMimeType, "text/xml"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/xml" ) );
      if (strcmp (UserMimeType, "text/plain"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/plain" ) );
      if (strcmp (UserMimeType, "text/css"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "text/css" ) );
      if (strcmp (UserMimeType, "application/smil"))
        XRCCTRL(*this, "wxID_MIME_TYPE_CB",
                wxComboBox)->Append( TtaConvMessageToWX( "application/smil" ) );
    }
  XRCCTRL(*this, "wxID_MIME_TYPE_CB", wxComboBox)->SetValue( wx_mime_type );

  // buttons
  XRCCTRL(*this, "wxID_SAVE", wxButton)->SetLabel(TtaConvMessageToWX( TtaGetMessage(LIB, TMSG_BUTTON_SAVE) ));
  XRCCTRL(*this, "wxID_CANCEL", wxButton)->SetLabel(TtaConvMessageToWX( TtaGetMessage(LIB, TMSG_CANCEL) ));
  XRCCTRL(*this, "wxID_BROWSE", wxBitmapButton)->SetToolTip(TtaConvMessageToWX(TtaGetMessage(AMAYA,AM_BROWSE)));
  XRCCTRL(*this, "wxID_CLEAR", wxButton)->SetToolTip(TtaConvMessageToWX( TtaGetMessage(AMAYA, AM_CLEAR) ));
  
  Fit();
  Refresh();
  SetAutoLayout( TRUE );

  // set te cursor to the end
  XRCCTRL(*this, "wxID_DOC_LOCATION_CTRL", wxTextCtrl)->SetInsertionPointEnd();
  // give focus to ...
  XRCCTRL(*this, "wxID_DOC_LOCATION_CTRL", wxTextCtrl)->SetFocus();
}
Exemplo n.º 21
0
void PowerManDlg::initIndex() {
    SetTitle(wxGetApp().getMsg( "boostertable" ));

    m_BoosterList->DeleteAllItems();

    iONode model = wxGetApp().getModel();
    if( model != NULL ) {
        iONode boosterlist = wPlan.getboosterlist( model );
        if( boosterlist == NULL ) {
            boosterlist = NodeOp.inst( wBoosterList.name(), model, ELEMENT_NODE );
            NodeOp.addChild( model, boosterlist );
        }

        if( boosterlist != NULL ) {
            int idx = 0;

            iOList list = ListOp.inst();
            int cnt = NodeOp.getChildCnt( boosterlist );
            for( int i = 0; i < cnt; i++ ) {
                iONode booster = NodeOp.getChild( boosterlist, i );
                const char* id = wBooster.getid( booster );
                if( id != NULL ) {
                    ListOp.add(list, (obj)booster);
                }
            }

            if( m_SortCol == 1 ) {
                ListOp.sort(list, &__sortDistrict);
            }
            else if( m_SortCol == 2 ) {
                ListOp.sort(list, &__sortUID);
            }
            else {
                ListOp.sort(list, &__sortID);
            }

            cnt = ListOp.size( list );
            for( int idx = 0; idx < cnt; idx++ ) {
                iONode booster = (iONode)ListOp.get( list, idx );
                const char* id = wBooster.getid( booster );
                m_BoosterList->InsertItem( idx, wxString(id,wxConvUTF8) );
                m_BoosterList->SetItem( idx, 1, wxString(wBooster.getdistrict( booster ), wxConvUTF8) );
                m_BoosterList->SetItem( idx, 2, wxString::Format(wxT("%d"), wBooster.getuid( booster )) );
                m_BoosterList->SetItemPtrData(idx, (wxUIntPtr)booster);

            }

            // resize
            for( int n = 0; n < 3; n++ ) {
                m_BoosterList->SetColumnWidth(n, wxLIST_AUTOSIZE_USEHEADER);
                int autoheadersize = m_BoosterList->GetColumnWidth(n);
                m_BoosterList->SetColumnWidth(n, wxLIST_AUTOSIZE);
                int autosize = m_BoosterList->GetColumnWidth(n);
                if(autoheadersize > autosize )
                    m_BoosterList->SetColumnWidth(n, wxLIST_AUTOSIZE_USEHEADER);
            }

            /* clean up the temp. list */
            ListOp.base.del(list);
        }

    }

    if( m_Props != NULL ) {
        setSelection(wBooster.getid( m_Props ));
        initValues();
    }
    else if(m_BoosterList->GetItemCount() > 0 ) {
        TraceOp.trc( "powermandlg", TRCLEVEL_INFO, __LINE__, 9999, "no selection" );
        m_BoosterList->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
        m_Props = (iONode)m_BoosterList->GetItemData(0);
        initValues();
    }

}
void CReportEntityPicture::SetFilename( const CString& filename )
/* ============================================================
	Function :		CReportEntityPicture::SetFilename
	Description :	Accessor. Setter for "m_filename".
	Access :		Public

	Return :		void
	Parameters :	const CString& filename	-	New filename
					
	Usage :			Call to set the value of "m_filename".

   ============================================================*/
{
	m_filename = filename;
	
	if( m_filename.GetLength() )
	{

		delete m_bitmap;
		delete[] m_image_bits;
		m_image_size = 0;
		m_image_type = -1;
		
		int imageType = TypeFromExtension_222(FindExtension_222(m_filename));
		if (imageType==CXIMAGE_FORMAT_UNKNOWN)
		{
			ASSERT(0);
			m_filename = CString("");
			return;
		}

		CFile			file;
		CFileException	fe;

		if (!file.Open(m_filename, CFile::modeRead, &fe))
		{
			ASSERT(0);
			m_filename = CString("");
		}

		m_image_size = (unsigned int)file.GetLength();
		m_image_type = imageType;

		try
		{
			m_image_bits = new BYTE[m_image_size];
		}
		catch (std::bad_alloc) 
		{
			AfxMessageBox("bad_alloc exception in SetFileName function");
			m_image_size = 0;
			m_image_type = -1;
			file.Close();
			m_filename = CString("");
			ASSERT(0);
			return;
		}

		if (file.Read(m_image_bits,m_image_size*sizeof(BYTE))!=m_image_size*sizeof(BYTE))
		{
			delete[] m_image_bits;
			m_image_size = 0;
			m_image_type = -1;
			file.Close();
			m_filename = CString("");
			ASSERT(0);
			return;
		}

		m_bitmap = new CxImage(m_image_bits, m_image_size, m_image_type);

		if (!m_bitmap->IsValid())
		{
			AfxMessageBox(m_bitmap->GetLastError());
			delete m_bitmap;
			delete[] m_image_bits;
			m_image_size = 0;
			m_image_type = -1;
			file.Close();
			m_filename = CString("");
			ASSERT(0);
			return;
		}
		file.Close();
	}
	
	CString title( m_filename );
	int found = title.ReverseFind( _TCHAR( '\\' ) );
	if( found != -1 )
		title = title.Right( title.GetLength() - ( found + 1 ) );

	SetTitle( title );

}
Exemplo n.º 23
0
void CISOProperties::OnChangeTitle(wxCommandEvent& event)
{
    SetTitle(event.GetString());
}
Exemplo n.º 24
0
void 
MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
                                     const char* const* aFormatNames,
                                     int32_t aWidth, int32_t aHeight,
                                     const nsAString& aStatus)
{
  nsXPIDLString fileStr;
  GetFileName(fileStr);

  NS_ConvertASCIItoUTF16 typeStr(aTypeStr);
  nsXPIDLString title;

  if (mStringBundle) {
    // if we got a valid size (not all media have a size)
    if (aWidth != 0 && aHeight != 0) {
      nsAutoString widthStr;
      nsAutoString heightStr;
      widthStr.AppendInt(aWidth);
      heightStr.AppendInt(aHeight);
      // If we got a filename, display it
      if (!fileStr.IsEmpty()) {
        const PRUnichar *formatStrings[4]  = {fileStr.get(), typeStr.get(), 
          widthStr.get(), heightStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDimAndFile]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 4,
                                            getter_Copies(title));
      } 
      else {
        const PRUnichar *formatStrings[3]  = {typeStr.get(), widthStr.get(), 
          heightStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDim]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 3,
                                            getter_Copies(title));
      }
    } 
    else {
    // If we got a filename, display it
      if (!fileStr.IsEmpty()) {
        const PRUnichar *formatStrings[2] = {fileStr.get(), typeStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithFile]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
                                            getter_Copies(title));
      }
      else {
        const PRUnichar *formatStrings[1] = {typeStr.get()};
        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithNoInfo]);
        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 1,
                                            getter_Copies(title));
      }
    }
  } 

  // set it on the document
  if (aStatus.IsEmpty()) {
    SetTitle(title);
  }
  else {
    nsXPIDLString titleWithStatus;
    const nsPromiseFlatString& status = PromiseFlatString(aStatus);
    const PRUnichar *formatStrings[2] = {title.get(), status.get()};
    NS_NAMED_LITERAL_STRING(fmtName, "TitleWithStatus");
    mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
                                        getter_Copies(titleWithStatus));
    SetTitle(titleWithStatus);
  }
}
Exemplo n.º 25
0
// show project properties
//
void CDlgItemProperties::renderInfos(PROJECT* project_in) {
    std::string projectname;
    //collecting infos
    project_in->get_name(projectname);
    //disk usage needs additional lookups
    CMainDocument* pDoc = wxGetApp().GetDocument();
    pDoc->CachedDiskUsageUpdate();
    
    // CachedDiskUsageUpdate() may have invalidated our project 
    // pointer, so get an updated pointer to this project
    PROJECT* project = pDoc->project(project_in->master_url);
    if (!project) return;     // TODO: display some sort of error alert?

    std::vector<PROJECT*> dp = pDoc->disk_usage.projects;
    double diskusage=0.0;    
    for (unsigned int i=0; i< dp.size(); i++) {
        PROJECT* tp = dp[i];        
        std::string tname;        
        tp->get_name(tname);
        wxString t1(wxString(tname.c_str(), wxConvUTF8));
        if(t1.IsSameAs(wxString(projectname.c_str(), wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url, wxConvUTF8))) {
            diskusage = tp->disk_usage;
            break;
        }
    }
    //set dialog title
    wxString wxTitle = _("Properties of project ");
    wxTitle.append(wxString(projectname.c_str(),wxConvUTF8));
    SetTitle(wxTitle);
    //layout controls
    addSection(_("General"));
    addProperty(_("URL"), wxString(project->master_url, wxConvUTF8));
    addProperty(_("User name"), wxString(project->user_name.c_str(), wxConvUTF8));
    addProperty(_("Team name"), wxString(project->team_name.c_str(), wxConvUTF8));
    addProperty(_("Resource share"), wxString::Format(wxT("%0.0f"), project->resource_share));
    if (project->min_rpc_time > dtime()) {
        addProperty(_("Scheduler RPC deferred for"), FormatTime(project->min_rpc_time - dtime()));
    }
    if (project->download_backoff) {
        addProperty(_("File downloads deferred for"), FormatTime(project->download_backoff));
    }
    if (project->upload_backoff) {
        addProperty(_("File uploads deferred for"), FormatTime(project->upload_backoff));
    }
    addProperty(_("Disk usage"), FormatDiskSpace(diskusage));
    addProperty(_("Computer ID"), wxString::Format(wxT("%d"), project->hostid));
    if (project->non_cpu_intensive) {
        addProperty(_("Non CPU intensive"), _("yes"));
    }
    addProperty(_("Suspended via GUI"), project->suspended_via_gui ? _("yes") : _("no"));
    addProperty(_("Don't request tasks"), project->dont_request_more_work ? _("yes") : _("no"));
    if (project->scheduler_rpc_in_progress) {
        addProperty(_("Scheduler call in progress"), _("yes"));
    }
    if (project->trickle_up_pending) {
        addProperty(_("Trickle-up pending"), _("yes"));
    }
    if (strlen(project->venue)) {
        addProperty(_("Host location"), wxString(project->venue, wxConvUTF8));
    } else {
        addProperty(_("Host location"), _("default"));
    }

    if (project->attached_via_acct_mgr) {
        addProperty(_("Added via account manager"), _("yes"));
    }
    if (project->detach_when_done) {
        addProperty(_("Remove when tasks done"), _("yes"));
    }
    if (project->ended) {
        addProperty(_("Ended"), _("yes"));
    }
    addProperty(_("Tasks completed"), wxString::Format(wxT("%d"), project->njobs_success));
    addProperty(_("Tasks failed"), wxString::Format(wxT("%d"), project->njobs_error));

    addSection(_("Credit"));
    addProperty(_("User"),
		// Displays the average and total user credit
        wxString::Format(
            _("%0.2f total, %0.2f average"),
            project->user_total_credit,
            project->user_expavg_credit
        )
    );
    addProperty(_("Host"),
		// Displays the average and total host credit
        wxString::Format(
            _("%0.2f total, %0.2f average"),
            project->host_total_credit,
            project->host_expavg_credit
        )
    );
    
    if (!project->non_cpu_intensive) {
        addSection(_("Scheduling"));
        addProperty(_("Scheduling priority"), wxString::Format(wxT("%0.2f"), project->sched_priority));
        show_rsc(_("CPU"), project->rsc_desc_cpu);
        if (pDoc->state.host_info.coprocs.have_nvidia()) {
            show_rsc(
                wxString(proc_type_name(PROC_TYPE_NVIDIA_GPU), wxConvUTF8),
                project->rsc_desc_nvidia
            );
        }
        if (pDoc->state.host_info.coprocs.have_ati()) {
            show_rsc(
                wxString(proc_type_name(PROC_TYPE_AMD_GPU), wxConvUTF8),
                project->rsc_desc_ati
            );
        }
        if (pDoc->state.host_info.coprocs.have_intel_gpu()) {
            show_rsc(
                wxString(proc_type_name(PROC_TYPE_INTEL_GPU), wxConvUTF8),
                project->rsc_desc_intel_gpu
            );
        }
        double dcf = project->duration_correction_factor;
        // if it's exactly 1, it's not being used
        //
        if (dcf != 1) {
            addProperty(
                _("Duration correction factor"),
                wxString::Format(wxT("%0.4f"), dcf)
            );
        }
    }
    if (project->last_rpc_time) {
        wxDateTime dt;
        dt.Set((time_t)project->last_rpc_time);
        addProperty(_("Last scheduler reply"), dt.Format());
    }
    m_gbSizer->Layout();
    m_scrolledWindow->FitInside();
}
Exemplo n.º 26
0
void ProcessDlg::set_properties()
{
    // begin wxGlade: ProcessDlg::set_properties
    SetTitle(wxT("Process"));
    // end wxGlade
}
Exemplo n.º 27
0
void wxFileDialog::SetMessage(const wxString& message)
{
    m_message = message;
    SetTitle(message);
}
Exemplo n.º 28
0
CButton::CButton(const int vx,const int vy,const int vw,const int vh,CWnd* vowner,const PCHAR title,const int vcommand)
:CWnd(NULL,vx,vy,vw,vh,vowner,vcommand)
{
	SetTitle(title);
}
Exemplo n.º 29
0
PersonWindow::PersonWindow(BRect frame, const char* title,
		const char* nameAttribute, const char* categoryAttribute,
		const entry_ref* ref)
	:
	BWindow(frame, title, B_TITLED_WINDOW, B_NOT_ZOOMABLE
		| B_AUTO_UPDATE_SIZE_LIMITS),
	fRef(NULL),
	fPanel(NULL),
	fNameAttribute(nameAttribute)
{
	BMenu* menu;
	BMenuItem* item;

	BMenuBar* menuBar = new BMenuBar("");
	menu = new BMenu(B_TRANSLATE("File"));
	menu->AddItem(item = new BMenuItem(
		B_TRANSLATE("New person" B_UTF8_ELLIPSIS),
		new BMessage(M_NEW), 'N'));
	item->SetTarget(be_app);
	menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
		new BMessage(B_QUIT_REQUESTED), 'W'));
	menu->AddSeparatorItem();
	menu->AddItem(fSave = new BMenuItem(B_TRANSLATE("Save"),
		new BMessage(M_SAVE), 'S'));
	fSave->SetEnabled(FALSE);
	menu->AddItem(new BMenuItem(
		B_TRANSLATE("Save as" B_UTF8_ELLIPSIS),
		new BMessage(M_SAVE_AS)));
	menu->AddItem(fRevert = new BMenuItem(B_TRANSLATE("Revert"),
		new BMessage(M_REVERT), 'R'));
	fRevert->SetEnabled(FALSE);
	menu->AddSeparatorItem();
	item = new BMenuItem(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED), 'Q');
	item->SetTarget(be_app);
	menu->AddItem(item);
	menuBar->AddItem(menu);

	menu = new BMenu(B_TRANSLATE("Edit"));
	menu->AddItem(fUndo = new BMenuItem(B_TRANSLATE("Undo"),
		new BMessage(B_UNDO), 'Z'));
	fUndo->SetEnabled(false);
	menu->AddSeparatorItem();
	menu->AddItem(fCut = new BMenuItem(B_TRANSLATE("Cut"),
		new BMessage(B_CUT), 'X'));
	menu->AddItem(fCopy = new BMenuItem(B_TRANSLATE("Copy"),
		new BMessage(B_COPY), 'C'));
	menu->AddItem(fPaste = new BMenuItem(B_TRANSLATE("Paste"),
		new BMessage(B_PASTE), 'V'));
	BMenuItem* selectAllItem = new BMenuItem(B_TRANSLATE("Select all"),
		new BMessage(M_SELECT), 'A');
	menu->AddItem(selectAllItem);
	menu->AddSeparatorItem();
	menu->AddItem(item = new BMenuItem(B_TRANSLATE("Configure attributes"),
		new BMessage(M_CONFIGURE_ATTRIBUTES), 'F'));
	item->SetTarget(be_app);
	menuBar->AddItem(menu);

	if (ref != NULL) {
		SetTitle(ref->name);
		_SetToRef(new entry_ref(*ref));
	} else
		_SetToRef(NULL);

	fView = new PersonView("PeopleView", categoryAttribute, fRef);

	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.Add(menuBar)
		.AddGroup(B_VERTICAL, 0)
			.Add(fView)
			.SetInsets(B_USE_WINDOW_SPACING)
			.End();

	fRevert->SetTarget(fView);
	selectAllItem->SetTarget(fView);
}
Exemplo n.º 30
0
void
MessageWindow::MessageReceived (BMessage *msg)
{
  switch (msg->what)
  {
    case M_SERVER_SHUTDOWN:
    {
      // No command to IRC connection
      // Just yank her
      PostMessage (B_QUIT_REQUESTED);
      break;
    }

    case M_CHANGE_NICK:
    {
      const char *oldNick, *newNick;

      msg->FindString ("oldnick", &oldNick);
      msg->FindString ("newnick", &newNick);

      if (chatee.ICompare (oldNick) == 0)
      {
        const char *address;
        const char *ident;

        msg->FindString ("address", &address);
        msg->FindString ("ident", &ident);

        BString oldId (id);
        chatee = id = newNick;

        if (dChat)
          id.Append(" [DCC]");
				
        // SEND NOTIFY -- We could crash the deskbar
        // (who I'm I kidding -- We crashed the deskbar)
        // without it (BEFORE DISPLAYS!!!)
        BMessage bmsg (M_ID_CHANGE);

        bmsg.AddInt32 ("sid", sid);
        bmsg.AddString ("id", oldId.String());
        bmsg.AddString ("newid", id.String());
        be_app->PostMessage (&bmsg);

        BString title;
				
        title << id << " (" << ident 
          << "@" << address << ")";
        SetTitle (title.String());

        ClientWindow::MessageReceived (msg);
      }
      else if (myNick.ICompare (oldNick) == 0)
      {
        status->SetItemValue (STATUS_NICK, newNick);
        ClientWindow::MessageReceived (msg);
      }

      break;
    }

    case M_CHANNEL_MODES:
    {
      const char *msgz;

      msg->FindString ("msgz", &msgz);
      Display (msgz, &opColor);
      break;
    }

    case M_CHANNEL_MSG:
    {
      const char *nick;

      if (msg->HasString ("nick"))
        msg->FindString ("nick", &nick);
      else
      {
        nick = chatee.String();
        msg->AddString ("nick", nick);
      }

      // This is mostly because if we send first
      // and we have open message window, this
      // will update the title bar for the address
      if (chatee.ICompare (nick) == 0
      &&  msg->HasString ("ident")
      &&  msg->HasString ("address"))
      {
        const char *ident;
        const char *address;

        msg->FindString ("ident", &ident);
        msg->FindString ("address", &address);

        BString title;

        title << id << " (" << ident
          << "@" << address << ")";

        if (title != Title())
          SetTitle (title.String());
      }

      // Send the rest of processing up the chain
      ClientWindow::MessageReceived (msg);
      break;
    }
		
    case M_LAG_CHANGED:
    {
      BString lag;
      msg->FindString("lag", &lag);
      status->SetItemValue(STATUS_LAG, lag.String());
    }

    default:
      ClientWindow::MessageReceived (msg);
  }
}