Ejemplo n.º 1
0
bool wxSpinCtrl::Create(wxWindow *parent,
                        wxWindowID id,
                        const wxString& value,
                        const wxPoint& pos,
                        const wxSize& size,
                        long style,
                        int min, int max, int initial,
                        const wxString& name)
{
    // before using DoGetBestSize(), have to set style to let the base class
    // know whether this is a horizontal or vertical control (we're always
    // vertical)
    style |= wxSP_VERTICAL;

    if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT )
#ifdef __WXWINCE__
        style |= wxBORDER_SIMPLE;
#else
        style |= wxBORDER_SUNKEN;
#endif

    SetWindowStyle(style);

    WXDWORD exStyle = 0;
    WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;

    // Scroll text automatically if there is not enough space to show all of
    // it, this is better than not allowing to enter more digits at all.
    msStyle |= ES_AUTOHSCROLL;

    // propagate text alignment style to text ctrl
    if ( style & wxALIGN_RIGHT )
        msStyle |= ES_RIGHT;
    else if ( style & wxALIGN_CENTER )
        msStyle |= ES_CENTER;

    // calculate the sizes: the size given is the total size for both controls
    // and we need to fit them both in the given width (height is the same)
    wxSize sizeText(size), sizeBtn(size);
    sizeBtn.x = wxSpinButton::DoGetBestSize().x;
    if ( sizeText.x <= 0 )
    {
        // DEFAULT_ITEM_WIDTH is the default width for the text control
        sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x;
    }

    sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
    if ( sizeText.x <= 0 )
    {
        wxLogDebug(wxS("wxSpinCtrl \"%s\": initial width %d is too small, ")
                   wxS("at least %d pixels needed."),
                   name, size.x, sizeBtn.x + MARGIN_BETWEEN + 1);
    }

    wxPoint posBtn(pos);
    posBtn.x += sizeText.x + MARGIN_BETWEEN;

    // we must create the text control before the spin button for the purpose
    // of the dialog navigation: if there is a static text just before the spin
    // control, activating it by Alt-letter should give focus to the text
    // control, not the spin and the dialog navigation code will give focus to
    // the next control (at Windows level), not the one after it

    // create the text window

    m_hwndBuddy = (WXHWND)::CreateWindowEx
                    (
                     exStyle,                // sunken border
                     wxT("EDIT"),             // window class
                     NULL,                   // no window title
                     msStyle,                // style (will be shown later)
                     pos.x, pos.y,           // position
                     0, 0,                   // size (will be set later)
                     GetHwndOf(parent),      // parent
                     (HMENU)-1,              // control id
                     wxGetInstance(),        // app instance
                     NULL                    // unused client data
                    );

    if ( !m_hwndBuddy )
    {
        wxLogLastError(wxT("CreateWindow(buddy text window)"));

        return false;
    }


    // create the spin button
    if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) )
    {
        return false;
    }

    wxSpinButtonBase::SetRange(min, max);

    // subclass the text ctrl to be able to intercept some events
    gs_spinForTextCtrl[GetBuddyHwnd()] = this;

    m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(),
                                                wxBuddyTextWndProc);

    // set up fonts and colours  (This is nomally done in MSWCreateControl)
    InheritAttributes();
    if (!m_hasFont)
        SetFont(GetDefaultAttributes().font);

    // set the size of the text window - can do it only now, because we
    // couldn't call DoGetBestSize() before as font wasn't set
    if ( sizeText.y <= 0 )
    {
        int cx, cy;
        wxGetCharSize(GetHWND(), &cx, &cy, GetFont());

        sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
    }

    SetInitialSize(size);

    (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW);

    // associate the text window with the spin button
    (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0);

    // If the initial text value is actually a number, it overrides the
    // "initial" argument specified later.
    long initialFromText;
    if ( value.ToLong(&initialFromText) )
        initial = initialFromText;

    // Set the range in the native control: notice that we must do it before
    // calling SetValue() to use the correct validity checks for the initial
    // value.
    SetRange(min, max);
    SetValue(initial);

    // Also set the text part of the control if it was specified independently
    // but don't generate an event for this, it would be unexpected.
    m_blockEvent = true;
    if ( !value.empty() )
        SetValue(value);
    m_blockEvent = false;

    return true;
}
Ejemplo n.º 2
0
//~~ AdeElementIterator GetFirstComponent() [AdeClass] ~~

wxString entry;
long index;
std::list<wxFileName> ret;

myConfig->SetPath(wxS("/Components"));
bool cont = myConfig->GetFirstEntry(entry, index);

while (cont)
{
    ret.push_back(AdeGUIDCache::Instance()->GetCachedEntry(entry));
    cont = myConfig->GetNextEntry(entry, index);
}
myConfig->SetPath(wxS("/"));

return AdeElementIterator(ret);
Ejemplo n.º 3
0
//~~ void OnReload(wxCommandEvent& event) [SeqFrame] ~~

if (textTab->IsModified())
{
	int answer = wxMessageDialog(this, wxS("You made changes. Save?"), wxS("Save Changes?"), wxCANCEL | wxYES | wxNO | wxICON_QUESTION).ShowModal();

	wxCommandEvent anEvent;

	if (answer == wxID_YES)
		Save(anEvent);

	if (answer == wxID_CANCEL)
		return;
}

Load(currentFile);
Ejemplo n.º 4
0
//~~ void Load(wxConfigBase& configObject) [scPerson] ~~

configObject.Read(wxS("Label"), &myLabel);
myLabel.Trim(false);
myLabel.Trim(true);
myLabel.Replace(wxS("\t"), wxS(" "));
myLabel.Replace(wxS("\n"), wxS(" "));
myLabel.Replace(wxS("  "), wxS(" "));

configObject.Read(wxS("Male"), &male);
configObject.Read(wxS("Child"), &child);
glNode::Load(configObject);
Ejemplo n.º 5
0
return AdeDirectoryElement::CreateNewElement(parentFolder, wxS("relations"), ITEM_IS_RELATIONS, false);
Ejemplo n.º 6
0
    // Set the size and shape of the tip window and returns the offset of its
    // content area from the top (horizontal offset is always 0 currently).
    int SetTipShapeAndSize(wxTipKind tipKind, const wxSize& contentSize)
    {
#if wxUSE_GRAPHICS_CONTEXT
        wxSize size = contentSize;

        // The size is the vertical size and the offset is the distance from
        // edge for asymmetric tips, currently hard-coded to be the same as the
        // size.
        const int tipSize = GetTipHeight();
        const int tipOffset = tipSize;

        // The horizontal position of the tip.
        int x = -1;

        // The vertical coordinates of the tip base and apex.
        int yBase = -1,
            yApex = -1;

        // The offset of the content part of the window.
        int dy = -1;

        // Define symbolic names for the rectangle corners and mid-way points
        // that we use below in an attempt to make the code more clear. Notice
        // that these values must be consecutive as we iterate over them.
        enum RectPoint
        {
            RectPoint_TopLeft,
            RectPoint_Top,
            RectPoint_TopRight,
            RectPoint_Right,
            RectPoint_BotRight,
            RectPoint_Bot,
            RectPoint_BotLeft,
            RectPoint_Left,
            RectPoint_Max
        };

        // The starting point for AddArcToPoint() calls below, we iterate over
        // all RectPoints from it.
        RectPoint pointStart = RectPoint_Max;


        // Hard-coded radius of the round main rectangle corners.
        const double RADIUS = 5;

        // Create a path defining the shape of the tooltip window.
        wxGraphicsPath
            path = wxGraphicsRenderer::GetDefaultRenderer()->CreatePath();

        if ( tipKind == wxTipKind_Auto )
            tipKind = GetBestTipKind();

        // Points defining the tip shape (in clockwise order as we must end at
        // tipPoints[0] after drawing the rectangle outline in this order).
        wxPoint2DDouble tipPoints[3];

        switch ( tipKind )
        {
            case wxTipKind_Auto:
                wxFAIL_MSG( "Impossible kind value" );
                break;

            case wxTipKind_TopLeft:
                x = tipOffset;
                yApex = 0;
                yBase = tipSize;
                dy = tipSize;

                tipPoints[0] = wxPoint2DDouble(x, yBase);
                tipPoints[1] = wxPoint2DDouble(x, yApex);
                tipPoints[2] = wxPoint2DDouble(x + tipSize, yBase);

                pointStart = RectPoint_TopRight;
                break;

            case wxTipKind_TopRight:
                x = size.x - tipOffset;
                yApex = 0;
                yBase = tipSize;
                dy = tipSize;

                tipPoints[0] = wxPoint2DDouble(x - tipSize, yBase);
                tipPoints[1] = wxPoint2DDouble(x, yApex);
                tipPoints[2] = wxPoint2DDouble(x, yBase);

                pointStart = RectPoint_TopRight;
                break;

            case wxTipKind_BottomLeft:
                x = tipOffset;
                yApex = size.y + tipSize;
                yBase = size.y;
                dy = 0;

                tipPoints[0] = wxPoint2DDouble(x + tipSize, yBase);
                tipPoints[1] = wxPoint2DDouble(x, yApex);
                tipPoints[2] = wxPoint2DDouble(x, yBase);

                pointStart = RectPoint_BotLeft;
                break;

            case wxTipKind_BottomRight:
                x = size.x - tipOffset;
                yApex = size.y + tipSize;
                yBase = size.y;
                dy = 0;

                tipPoints[0] = wxPoint2DDouble(x, yBase);
                tipPoints[1] = wxPoint2DDouble(x, yApex);
                tipPoints[2] = wxPoint2DDouble(x - tipSize, yBase);

                pointStart = RectPoint_BotLeft;
                break;

            case wxTipKind_Top:
                x = size.x/2;
                yApex = 0;
                yBase = tipSize;
                dy = tipSize;

                {
                    // A half-side of an equilateral triangle is its altitude
                    // divided by sqrt(3) ~= 1.73.
                    const double halfside = tipSize/1.73;

                    tipPoints[0] = wxPoint2DDouble(x - halfside, yBase);
                    tipPoints[1] = wxPoint2DDouble(x, yApex);
                    tipPoints[2] = wxPoint2DDouble(x + halfside, yBase);
                }

                pointStart = RectPoint_TopRight;
                break;

            case wxTipKind_Bottom:
                x = size.x/2;
                yApex = size.y + tipSize;
                yBase = size.y;
                dy = 0;

                {
                    const double halfside = tipSize/1.73;

                    tipPoints[0] = wxPoint2DDouble(x + halfside, yBase);
                    tipPoints[1] = wxPoint2DDouble(x, yApex);
                    tipPoints[2] = wxPoint2DDouble(x - halfside, yBase);
                }

                pointStart = RectPoint_BotLeft;
                break;

            case wxTipKind_None:
                x = size.x/2;
                dy = 0;

                path.AddRoundedRectangle(0, 0, size.x, size.y, RADIUS);
                break;
        }

        wxASSERT_MSG( dy != -1, wxS("Unknown tip kind?") );

        size.y += tipSize;
        SetSize(size);

        if ( tipKind != wxTipKind_None )
        {
            path.MoveToPoint(tipPoints[0]);
            path.AddLineToPoint(tipPoints[1]);
            path.AddLineToPoint(tipPoints[2]);

            const double xLeft = 0.;
            const double xMid = size.x/2.;
            const double xRight = size.x;

            const double yTop = dy;
            const double yMid = (dy + size.y)/2.;
            const double yBot = dy + contentSize.y;

            wxPoint2DDouble rectPoints[RectPoint_Max];
            rectPoints[RectPoint_TopLeft]  = wxPoint2DDouble(xLeft,  yTop);
            rectPoints[RectPoint_Top]      = wxPoint2DDouble(xMid,   yTop);
            rectPoints[RectPoint_TopRight] = wxPoint2DDouble(xRight, yTop);
            rectPoints[RectPoint_Right]    = wxPoint2DDouble(xRight, yMid);
            rectPoints[RectPoint_BotRight] = wxPoint2DDouble(xRight, yBot);
            rectPoints[RectPoint_Bot]      = wxPoint2DDouble(xMid,   yBot);
            rectPoints[RectPoint_BotLeft]  = wxPoint2DDouble(xLeft,  yBot);
            rectPoints[RectPoint_Left]     = wxPoint2DDouble(xLeft,  yMid);

            // Iterate over all rectangle rectPoints for the first 3 corners.
            unsigned n = pointStart;
            for ( unsigned corner = 0; corner < 3; corner++ )
            {
                const wxPoint2DDouble& pt1 = rectPoints[n];

                n = (n + 1) % RectPoint_Max;

                const wxPoint2DDouble& pt2 = rectPoints[n];

                path.AddArcToPoint(pt1.m_x, pt1.m_y, pt2.m_x, pt2.m_y, RADIUS);

                n = (n + 1) % RectPoint_Max;
            }

            // Last one wraps to the first point of the tip.
            const wxPoint2DDouble& pt1 = rectPoints[n];
            const wxPoint2DDouble& pt2 = tipPoints[0];

            path.AddArcToPoint(pt1.m_x, pt1.m_y, pt2.m_x, pt2.m_y, RADIUS);

            path.CloseSubpath();
        }

        SetShape(path);
#else // !wxUSE_GRAPHICS_CONTEXT
        wxUnusedVar(tipKind);

        int x = contentSize.x/2,
            yApex = 0,
            dy = 0;

        SetSize(contentSize);
#endif // wxUSE_GRAPHICS_CONTEXT/!wxUSE_GRAPHICS_CONTEXT

        m_anchorPos.x = x;
        m_anchorPos.y = yApex;

        return dy;
    }
Ejemplo n.º 7
0
//~~ wxMenu* CreateRepositoryMenu() [AstadeModel] ~~

wxMenu* aSubUp = new wxMenu(wxEmptyString);

aSubUp->AppendRadioItem(ID_SELECTNONE, wxS("none"));
aSubUp->AppendRadioItem(ID_SELECTSVN, wxS("SVN / git-svn"));
aSubUp->Enable(ID_SELECTSVN, AdeRevisionControlSVN::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTGIT, wxS("Git"));
aSubUp->Enable(ID_SELECTGIT, AdeRevisionControlGIT::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTHG, wxS("Mercurial"));
aSubUp->Enable(ID_SELECTHG, AdeRevisionControlHg::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTMKS, wxS("MKS"));
aSubUp->Enable(ID_SELECTMKS, AdeRevisionControlMKS::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTCVS, wxS("CVS"));

AdeModel* theModel = dynamic_cast<AdeModel*>(myModelElement);

if (!theModel->GetRepository().CmpNoCase(wxS("CVS")))
	aSubUp->Check(ID_SELECTCVS, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("SVN")))
	aSubUp->Check(ID_SELECTSVN, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("MKS")))
	aSubUp->Check(ID_SELECTMKS, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("Mercurial")))
	aSubUp->Check(ID_SELECTHG, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("Git")))
	aSubUp->Check(ID_SELECTGIT, true);
else
	aSubUp->Check(ID_SELECTNONE, true);

return aSubUp;
Ejemplo n.º 8
0
//~~ void doH() [CGenerator] ~~

target.SetExt(wxS("h"));
std::ofstream out(target.GetFullPath().utf8_str());

wxFileName PrefixName(myAdeComponent->GetFileName());
PrefixName.SetFullName(wxS("prolog.h"));
wxTextFile Gprefixtext(PrefixName.GetFullPath());
if (Gprefixtext.Exists())
	Gprefixtext.Open();
if (Gprefixtext.IsOpened() && Gprefixtext.GetLineCount() > 0)
{
	wxString str;
	for (str = Gprefixtext.GetFirstLine(); !Gprefixtext.Eof(); str = Gprefixtext.GetNextLine())
		out << str.utf8_str() << std::endl;
	if (!str.empty())
		out << str.utf8_str() << std::endl;
	out << std::endl;
}

PrintHeader(out);

wxString defname(target.GetFullName());
defname.MakeUpper();
defname.Replace(wxS("."), wxS("_"));

out << "#ifndef __"   << defname.utf8_str() << std::endl;
out << "#  define __" << defname.utf8_str() << std::endl;
out << std::endl;

PrefixName = source->GetFileName();
Ejemplo n.º 9
0
//~~ void AddBrowseLine(wxSizer* topsizer, wxString staticText, wxTextCtrl*& theTextControl, int browseButtonID) [AstadeDirDialog] ~~

topsizer->Add(new wxStaticText(this, 0, staticText), 0, wxRIGHT, 10);

theTextControl = new wxTextCtrl(this, 0, wxEmptyString);
topsizer->Add(theTextControl, 1, wxRIGHT | wxEXPAND, 10);

topsizer->Add(new wxButton(this, browseButtonID, wxS("browse")), 0, wxRIGHT, 10);
Ejemplo n.º 10
0
void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea)
{
    /*
    Draws an arc of an ellipse. The current pen is used for drawing the arc
    and the current brush is used for drawing the pie.

    x and y specify the x and y coordinates of the upper-left corner of the
    rectangle that contains the ellipse.

    width and height specify the width and height of the rectangle that
    contains the ellipse.

    start and end specify the start and end of the arc relative to the
    three-o'clock position from the center of the rectangle. Angles are
    specified in degrees (360 is a complete circle). Positive values mean
    counter-clockwise motion. If start is equal to end, a complete ellipse
    will be drawn. */

    //radius
    double rx = w / 2.0;
    double ry = h / 2.0;
    // center
    double xc = x + rx;
    double yc = y + ry;

    // start and end coords
    double xs, ys, xe, ye;
    xs = xc + rx * cos (wxDegToRad(sa));
    xe = xc + rx * cos (wxDegToRad(ea));
    ys = yc - ry * sin (wxDegToRad(sa));
    ye = yc - ry * sin (wxDegToRad(ea));

    // svg arcs have 0 degrees at 12-o'clock instead of 3-o'clock
    double start = (sa - 90);
    if (start < 0)
        start += 360;
    while (abs(start) > 360)
        start -= (start / abs(start)) * 360;

    double end = (ea - 90);
    if (end < 0)
        end += 360;
    while (abs(end) > 360)
        end -= (end / abs(end)) * 360;

    // svg arcs are in clockwise direction, reverse angle
    double angle = end - start;
    if (angle <= 0)
        angle += 360;

    int fArc = angle > 180 ? 1 : 0; // flag for large or small arc
    int fSweep = 0;                 // flag for sweep always 0

    wxString arcPath;
    if (angle == 360)
    {
        // Drawing full circle fails with default arc. Draw two half arcs instead.
        fArc = 1;
        arcPath = wxString::Format(wxS("  <path d=\"M%s %s a%s %s 0 %d %d %s %s a%s %s 0 %d %d %s %s"),
            NumStr(x), NumStr(y + ry),
            NumStr(rx), NumStr(ry), fArc, fSweep, NumStr( rx * 2), NumStr(0),
            NumStr(rx), NumStr(ry), fArc, fSweep, NumStr(-rx * 2), NumStr(0));
    }
    else
    {
        arcPath = wxString::Format(wxS("  <path d=\"M%s %s A%s %s 0 %d %d %s %s"),
            NumStr(xs), NumStr(ys),
            NumStr(rx), NumStr(ry), fArc, fSweep, NumStr(xe), NumStr(ye));
    }

    // Workaround so SVG does not draw an extra line from the centre of the drawn arc
    // to the start point of the arc.
    // First draw the arc with the current brush, without a border,
    // then draw the border without filling the arc.
    if (GetBrush().GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
    {
        wxDCPenChanger setTransp(*GetOwner(), *wxTRANSPARENT_PEN);
        NewGraphicsIfNeeded();

        wxString arcFill = arcPath;
        arcFill += wxString::Format(wxS(" L%s %s z"), NumStr(xc), NumStr(yc));
        arcFill += wxS("\"/>\n");
        write(arcFill);
    }

    wxDCBrushChanger setTransp(*GetOwner(), *wxTRANSPARENT_BRUSH);
    NewGraphicsIfNeeded();

    wxString arcLine = arcPath + wxS("\"/>\n");
    write(arcLine);
}
Ejemplo n.º 11
0
//~~ wxString GetEventText(int eventNumber) [SeqDataBase] ~~

if (eventNumber < 0 ||
	static_cast<unsigned>(eventNumber) >= itsEvents.size())
	return wxEmptyString;

wxString format;
format.Printf(wxS("%%04d %%%ds %%%ds %%s %%-%ds %%s\n"), longestTimeStamp, longestObjectName, longestObjectName);

wxString ret;
wxString stamp(itsEvents[eventNumber].aTimeStamp+itsEvents[eventNumber].threadID);

switch (itsEvents[eventNumber].eventID)
{
	case ID_EXIST:
		ret.Printf(wxS("! %s\n"), classes[itsEvents[eventNumber].destinationObject].c_str());
		break;

	case ID_STATECHANGE:
		ret.Printf(format, eventNumber, stamp.c_str(), classes[itsEvents[eventNumber].sourceObject].c_str(), wxS(">>>"), itsEvents[eventNumber].label.c_str(), wxEmptyString);
		break;

	case ID_NOTE:
		ret.Printf(format, eventNumber, stamp.c_str(), classes[itsEvents[eventNumber].sourceObject].c_str(), wxS("note:"), itsEvents[eventNumber].label.c_str(), wxEmptyString);
		break;

	case ID_GLOBALCALL:
		ret.Printf(format, eventNumber, stamp.c_str(), wxS("~"), wxS("==>"), classes[itsEvents[eventNumber].destinationObject].c_str(), itsEvents[eventNumber].label.c_str());
		break;

	case ID_CALL:
Ejemplo n.º 12
0
void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
{
    /* Draws an arc of a circle, centred on (xc, yc), with starting point
    (x1, y1) and ending at (x2, y2). The current pen is used for the outline
    and the current brush for filling the shape.

    The arc is drawn in an anticlockwise direction from the start point to
    the end point.

    Might be better described as Pie drawing */

    NewGraphicsIfNeeded();
    wxString s;

    // we need the radius of the circle which has two estimates
    double r1 = sqrt ( double( (x1-xc)*(x1-xc) ) + double( (y1-yc)*(y1-yc) ) );
    double r2 = sqrt ( double( (x2-xc)*(x2-xc) ) + double( (y2-yc)*(y2-yc) ) );

    wxASSERT_MSG( (fabs ( r2-r1 ) <= 3), wxS("wxSVGFileDC::DoDrawArc Error in getting radii of circle"));
    if ( fabs ( r2-r1 ) > 3 )    //pixels
    {
        s = wxS("<!--- wxSVGFileDC::DoDrawArc Error in getting radii of circle -->\n");
        write(s);
    }

    double theta1 = atan2((double)(yc - y1), (double)(x1 - xc));
    if (theta1 < 0)
        theta1 = theta1 + M_PI * 2;

    double theta2 = atan2((double)(yc - y2), (double)(x2 - xc));
    if (theta2 < 0)
        theta2 = theta2 + M_PI * 2;
    if (theta2 < theta1) theta2 = theta2 + M_PI * 2;

    int fArc;                  // flag for large or small arc 0 means less than 180 degrees
    if (fabs(theta2 - theta1) > M_PI)
        fArc = 1; else fArc = 0;

    int fSweep = 0;             // flag for sweep always 0

    if (x1 == x2 && y1 == y2)
    {
        // drawing full circle fails with default arc. Draw two half arcs instead.
        s = wxString::Format(wxS("  <path d=\"M%d %d a%s %s 0 %d %d %s %s a%s %s 0 %d %d %s %s"),
            x1, y1,
            NumStr(r1), NumStr(r2), fArc, fSweep, NumStr( r1 * 2), NumStr(0),
            NumStr(r1), NumStr(r2), fArc, fSweep, NumStr(-r1 * 2), NumStr(0));
    }
    else
    {
        // comply to wxDC specs by drawing closing line if brush is not transparent
        wxString line;
        if (GetBrush().GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
            line = wxString::Format(wxS("L%d %d z"), xc, yc);

        s = wxString::Format(wxS("  <path d=\"M%d %d A%s %s 0 %d %d %d %d %s"),
            x1, y1, NumStr(r1), NumStr(r2), fArc, fSweep, x2, y2, line);
    }

    s += wxS("\"/>\n");

    write(s);
}
Ejemplo n.º 13
0
void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle)
{
    //known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW
    NewGraphicsIfNeeded();
    wxString s;

    // Get extent of whole text.
    wxCoord w, h, heightLine;
    GetOwner()->GetMultiLineTextExtent(sText, &w, &h, &heightLine);

    // Compute the shift for the origin of the next line.
    const double rad = wxDegToRad(angle);
    const double dx = heightLine * sin(rad);
    const double dy = heightLine * cos(rad);

    // wxS("upper left") and wxS("upper right")
    CalcBoundingBox(x, y);
    CalcBoundingBox((wxCoord)(x + w*cos(rad)), (wxCoord)(y - h*sin(rad)));

    // wxS("bottom left") and wxS("bottom right")
    CalcBoundingBox((wxCoord)(x + h*sin(rad)), (wxCoord)(y + h*cos(rad)));
    CalcBoundingBox((wxCoord)(x + h*sin(rad) + w*cos(rad)), (wxCoord)(y + h*cos(rad) - w*sin(rad)));

    if (m_backgroundMode == wxBRUSHSTYLE_SOLID)
    {
        // draw background first
        // just like DoDrawRectangle except we pass the text color to it and set the border to a 1 pixel wide text background
        s += wxString::Format(wxS("  <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" "), x, y, w, h);
        s += wxS("style=\"") + wxBrushString(m_textBackgroundColour);
        s += wxS("stroke-width:1; ") + wxPenString(m_textBackgroundColour);
        s += wxString::Format(wxS("\" transform=\"rotate(%s %d %d)\"/>"), NumStr(-angle), x, y);
        s += wxS("\n");
        write(s);
    }

    // Draw all text line by line
    const wxArrayString lines = wxSplit(sText, '\n', '\0');
    for (size_t lineNum = 0; lineNum < lines.size(); lineNum++)
    {
        // convert x,y to SVG text x,y (the coordinates of the text baseline)
        wxCoord ww, hh, desc;
        DoGetTextExtent(lines[lineNum], &ww, &hh, &desc);
        int xx = x + wxRound(lineNum * dx) + (hh - desc) * sin(rad);
        int yy = y + wxRound(lineNum * dy) + (hh - desc) * cos(rad);

        //now do the text itself
        s += wxString::Format(wxS("  <text x=\"%d\" y=\"%d\" textLength=\"%d\" "), xx, yy, ww);

        wxString fontName(m_font.GetFaceName());
        if (fontName.Len() > 0)
            s += wxS("style=\"font-family:") + fontName + wxS("; ");
        else
            s += wxS("style=\" ");

        wxString fontweight;
        switch (m_font.GetWeight())
        {
            case wxFONTWEIGHT_MAX:
                wxFAIL_MSG(wxS("invalid font weight value"));
                wxFALLTHROUGH;

            case wxFONTWEIGHT_NORMAL:
                fontweight = wxS("normal");
                break;

            case wxFONTWEIGHT_LIGHT:
                fontweight = wxS("lighter");
                break;

            case wxFONTWEIGHT_BOLD:
                fontweight = wxS("bold");
                break;
        }

        wxASSERT_MSG(!fontweight.empty(), wxS("unknown font weight value"));

        s += wxS("font-weight:") + fontweight + wxS("; ");

        wxString fontstyle;
        switch (m_font.GetStyle())
        {
            case wxFONTSTYLE_MAX:
                wxFAIL_MSG(wxS("invalid font style value"));
                wxFALLTHROUGH;

            case wxFONTSTYLE_NORMAL:
                fontstyle = wxS("normal");
                break;

            case wxFONTSTYLE_ITALIC:
                fontstyle = wxS("italic");
                break;

            case wxFONTSTYLE_SLANT:
                fontstyle = wxS("oblique");
                break;
        }

        wxASSERT_MSG(!fontstyle.empty(), wxS("unknown font style value"));

        s += wxS("font-style:") + fontstyle + wxS("; ");

        wxString textDecoration;
        if (m_font.GetUnderlined())
            textDecoration += wxS(" underline");
        if (m_font.GetStrikethrough())
            textDecoration += wxS(" line-through");
        if (textDecoration.IsEmpty())
            textDecoration = wxS(" none");

        s += wxS("text-decoration:") + textDecoration + wxS("; ");

        s += wxString::Format(wxS("font-size:%dpt; "), m_font.GetPointSize());
        //text will be solid, unless alpha value isn't opaque in the foreground colour
        s += wxBrushString(m_textForegroundColour) + wxPenString(m_textForegroundColour);
        s += wxString::Format(wxS("stroke-width:0;\" transform=\"rotate(%s %d %d)\""), NumStr(-angle), xx, yy);
        s += wxS(" xml:space=\"preserve\">");
        s += wxMarkupParser::Quote(lines[lineNum]) + wxS("</text>\n");

        write(s);
    }
}
Ejemplo n.º 14
0
//~~ int GetIconIndex() [AstadeTransition] ~~

wxArrayString names;

wxFileConfig theConfig(wxEmptyString, wxEmptyString, wxEmptyString, myModelElement->GetFileName().GetFullPath());

wxString TransitionType = theConfig.Read(wxS("Astade/TransitionType"));

if (TransitionType == wxS("Self"))
	names.Add(wxS("selftransition"));
else if (TransitionType == wxS("Internal"))
	names.Add(wxS("internaltransition"));
else
	names.Add(wxS("transition"));

if (search->isSet(AdeSearch::SearchIsActive))
{
	switch (myModelElement->Search(*search))
	{
	case AdeSearch::contain:
		names.Add(wxS("hasfound"));
		break;
	case AdeSearch::found:
		names.Add(wxS("found"));
		break;
	default:
		break;
	}
}
else
{
Ejemplo n.º 15
0
//~~ void AppendMenuItems(wxMenu& aPopUp) [AstadeFile] ~~

aPopUp.Append(ID_EDIT, wxS("edit"), wxEmptyString, wxITEM_NORMAL);
aPopUp.AppendSeparator();
aPopUp.Append(ID_DELETE, wxS("delete"), wxEmptyString, wxITEM_NORMAL);
Ejemplo n.º 16
0
{
  m_bReadOnly = bReadOnly;
  CGridLocusColumns::SetReadOnly(this,bReadOnly);
}

void CGridLabThresholds::DisableCell(int nRow, int nCol)
{
  SetReadOnly(nRow,nCol,true);
  SetCellBackgroundColour(nRow,nCol,
    GetGridLineColour());
  SetCellValue(nRow,nCol,wxEmptyString);
}


const wxChar * const CGridLabThresholds::FRACTION_MAX_PEAK =
  wxS("Fractional filter (0 - 1.0) ");
const wxChar * const CGridLabThresholds::PULLUP_FRACTIONAL_FILTER =
  wxS("Pullup fractional filter (0 - 1.0) ");
const wxChar * const CGridLabThresholds::STUTTER_THRESHOLD =
  wxS("Max. stutter threshold (0 - 1.0) ");
const wxChar * const CGridLabThresholds::PLUS_STUTTER_THRESHOLD =
  wxS("Max. plus stutter threshold (0 - 1.0) ");
const wxChar * const CGridLabThresholds::ADENYLATION_THRESHOLD =
  wxS("Adenylation threshold (0 - 1.0) ");

double CGridLabThresholds::GetCellValueDouble(int nRow, int nCol)
{
  wxString s = GetCellValue(nRow,nCol);
  double d;
  if(s.IsEmpty())
  {
Ejemplo n.º 17
0
static void
ShowException(const wxString& member,
              HRESULT hr,
              EXCEPINFO *pexcep,
              unsigned int uiArgErr)
{
    wxString message;
    switch (GetScode(hr))
    {
        case DISP_E_UNKNOWNNAME:
            message = _("Unknown name or named argument.");
            break;

        case DISP_E_BADPARAMCOUNT:
            message = _("Incorrect number of arguments.");
            break;

        case DISP_E_EXCEPTION:
            if ( pexcep )
            {
                if ( pexcep->bstrDescription )
                    message << pexcep->bstrDescription << wxS(" ");
                message += wxString::Format(wxS("error code %u"), pexcep->wCode);
            }
            else
            {
                message = _("Unknown exception");
            }
            break;

        case DISP_E_MEMBERNOTFOUND:
            message = _("Method or property not found.");
            break;

        case DISP_E_OVERFLOW:
            message = _("Overflow while coercing argument values.");
            break;

        case DISP_E_NONAMEDARGS:
            message = _("Object implementation does not support named arguments.");
            break;

        case DISP_E_UNKNOWNLCID:
            message = _("The locale ID is unknown.");
            break;

        case DISP_E_PARAMNOTOPTIONAL:
            message = _("Missing a required parameter.");
            break;

        case DISP_E_PARAMNOTFOUND:
            message.Printf(_("Argument %u not found."), uiArgErr);
            break;

        case DISP_E_TYPEMISMATCH:
            message.Printf(_("Type mismatch in argument %u."), uiArgErr);
            break;

        case ERROR_FILE_NOT_FOUND:
            message = _("The system cannot find the file specified.");
            break;

        case REGDB_E_CLASSNOTREG:
            message = _("Class not registered.");
            break;

        default:
            message.Printf(_("Unknown error %08x"), hr);
            break;
    }

    wxLogError(_("OLE Automation error in %s: %s"), member, message);
}
Ejemplo n.º 18
0
void wxNativeFontInfo::SetFamily(wxFontFamily family)
{
    wxArrayString facename;

    // the list of fonts associated with a family was partially
    // taken from http://www.codestyle.org/css/font-family

    switch ( family )
    {
        case wxFONTFAMILY_SCRIPT:
            // corresponds to the cursive font family in the page linked above
            facename.Add(wxS("URW Chancery L"));
            facename.Add(wxS("Comic Sans MS"));
            break;

        case wxFONTFAMILY_DECORATIVE:
            // corresponds to the fantasy font family in the page linked above
            facename.Add(wxS("Impact"));
            break;

        case wxFONTFAMILY_ROMAN:
            // corresponds to the serif font family in the page linked above
            facename.Add(wxS("Century Schoolbook L"));
            facename.Add(wxS("URW Bookman L"));
            facename.Add(wxS("URW Palladio L"));
            facename.Add(wxS("DejaVu Serif"));
            facename.Add(wxS("FreeSerif"));
            facename.Add(wxS("Times New Roman"));
            facename.Add(wxS("Times"));
            break;

        case wxFONTFAMILY_TELETYPE:
        case wxFONTFAMILY_MODERN:
            // corresponds to the monospace font family in the page linked above
            facename.Add(wxS("DejaVu Sans Mono"));
            facename.Add(wxS("Nimbus Mono L"));
            facename.Add(wxS("Bitstream Vera Sans Mono"));
            facename.Add(wxS("Andale Mono"));
            facename.Add(wxS("Lucida Sans Typewriter"));
            facename.Add(wxS("FreeMono"));
            facename.Add(wxS("Courier New"));
            facename.Add(wxS("Courier"));
            break;

        case wxFONTFAMILY_SWISS:
        case wxFONTFAMILY_DEFAULT:
        default:
            // corresponds to the sans-serif font family in the page linked above
            facename.Add(wxS("DejaVu Sans"));
            facename.Add(wxS("URW Gothic L"));
            facename.Add(wxS("Nimbus Sans L"));
            facename.Add(wxS("Bitstream Vera Sans"));
            facename.Add(wxS("Lucida Sans"));
            facename.Add(wxS("Arial"));
            facename.Add(wxS("FreeSans"));
            break;
    }

    SetFaceName(facename);
}
Ejemplo n.º 19
0
return AdeDirectoryElement::CreateNewElement(parentFolder, wxS("constructor"), ITEM_IS_OPERATION | ITEM_IS_PUBLIC, true);
Ejemplo n.º 20
0
wxConfigBase* theConfig = new wxFileConfig(wxS("AstadeCodeEdit.ini"));

bool whitespace = whitespaceBox->GetValue();

myEditControl->SetWhitespace(whitespace);

theConfig->Write(wxS("CodeEdit/Whitespace"), whitespace);

delete theConfig;
Ejemplo n.º 21
0
//~~ void AddInitializerSizer(wxSizer* topSizer, wxWindow* parent) [ResourceEdit] ~~

wxBoxSizer* box = new wxStaticBoxSizer(new wxStaticBox(parent, -1, wxS("Initializer:")), wxHORIZONTAL);

InitializerEditField = new wxTextCtrl(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
box->Add(InitializerEditField, 1, wxEXPAND);

topSizer->Add(box, 1, wxEXPAND|wxALL, 10);

InitializerEditField->SetValue(wxConfigBase::Get()->Read(wxS("Astade/Initializer"), wxEmptyString));
Ejemplo n.º 22
0
bool mainApp::OnInit()
{
  if(g_pThis != NULL) return false;
	if(!wxApp::OnInit()) return false;
  g_pThis = this;
  // Set up splash screen
#ifndef _DEBUG
  wxBitmap bitmap;
  if(CImageAbout::LoadBitmap(&bitmap))
  {
      new wxSplashScreen(bitmap,
      wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
      2000, NULL, -1, wxDefaultPosition, wxDefaultSize,
          wxSIMPLE_BORDER|wxSTAY_ON_TOP|wxFRAME_NO_TASKBAR);
    wxYield();
  }
#endif
  GetConfig();
  // set up log file if Debug directory exists
  _OpenMessageStream();

  // set up window

  m_pFrame = new mainFrame();
  bool bHasArgs = (argc > 1) && (argv[1] != (wxChar *)NULL);
#ifdef __WXMAC__
  if(m_asFiles.Count() > 0)
  {
    bHasArgs = true;
  }
#endif
  
  m_pFrame->Startup(bHasArgs);
  const wxChar *psFormat(wxS("argv[%d] = %ls"));
  LogMessageV(psFormat,0,argv[0].wc_str());
  for(int i = 1; i < argc; ++i)
  {
    LogMessageV(psFormat,i,argv[i].wc_str());
    m_pFrame->OpenFile(argv[i]);
  }
//  time_t t;
//  time(&t);
  wxString sPID = wxString::Format(wxS("PID: %d"),(int)getpid());
//  wxLog::OnLog(wxLOG_Message,(const wxChar *)sPID,t);
  LogMessage(sPID);
#if defined(__WXDEBUG__)
  const wxPlatformInfo &plat(wxPlatformInfo::Get());
  wxString sOS = wxString::Format(
    wxT("Platform:\n  OS: %s; %s\n  Version: %d.%d\n  Arch: %s\n  Toolkit: %d.%d\n  Port: %s"),
    (const char *) plat.GetOperatingSystemFamilyName().ToAscii(),
    (const char *) plat.GetOperatingSystemDescription().ToAscii(),
    plat.GetOSMajorVersion(),
    plat.GetOSMinorVersion(),
    (const char *)plat.GetArchName().ToAscii(),
    plat.GetToolkitMajorVersion(),
    plat.GetToolkitMinorVersion(),
    (const char *) plat.GetPortIdName().ToAscii());

  sOS += wxString::Format(wxS("\n  sizeof(char):        %d"),(int)(sizeof(char)));
  sOS += wxString::Format(wxS("\n  sizeof(wxChar):      %d"),(int)(sizeof(wxChar)));
  sOS += wxString::Format(wxS("\n  sizeof(wchar_t):     %d"),(int)(sizeof(wchar_t)));
  sOS += wxString::Format(wxS("\n  sizeof(short):       %d"),(int)(sizeof(short)));
  sOS += wxString::Format(wxS("\n  sizeof(int):         %d"),(int)(sizeof(int)));
  sOS += wxString::Format(wxS("\n  sizeof(long):        %d"),(int)(sizeof(long)));
  sOS += wxString::Format(wxS("\n  sizeof(longlong):    %d"),(int)(sizeof(long long)));
  sOS += wxString::Format(wxS("\n  sizeof(size_t):      %d"),(int)(sizeof(size_t)));
  sOS += wxString::Format(wxS("\n  sizeof(time_t):      %d"),(int)(sizeof(time_t)));
  sOS += wxString::Format(wxS("\n  sizeof(float):       %d"),(int)(sizeof(float)));
  sOS += wxString::Format(wxS("\n  sizeof(double):      %d"),(int)(sizeof(double)));
  sOS += wxString::Format(wxS("\n  sizeof(long double): %d"),(int)(sizeof(long double )));

  LogMessage(sOS);
#endif

#ifdef __WXDEBUG__

    
  m_pConfig->Log();

#endif
#ifdef __WXMAC__
  if(bHasArgs)
  {
    _MacOpenFiles();
  }
#endif
  return true;
}
Ejemplo n.º 23
0
wxString TransitionType(myConfig->Read(wxS("Astade/TransitionType")));
return TransitionType == wxS("Self");
Ejemplo n.º 24
0
//~~ void LoadRelations(wxConfigBase& configObject) [glUsecase] ~~

int count = 1;

wxString associationName;
associationName.Printf(wxS("Include%03d"), count);

while (configObject.Exists(associationName))
{
	int AssociationID;
	configObject.Read(associationName, &AssociationID);
	
	glNode* partnerNode = glNode::getNodeById(AssociationID);
	
	if (partnerNode)
		new glIncludeExtend(myParent, *this, *partnerNode, wxS("\xab" "include" "\xbb"));
	
	count++;
	associationName.Printf(wxS("Include%03d"), count);
}

count = 1;
associationName.Printf(wxS("Extention%03d"), count);

while (configObject.Exists(associationName))
{
	int AssociationID;
	configObject.Read(associationName,&AssociationID);
	
	glNode* partnerNode = glNode::getNodeById(AssociationID);
	
Ejemplo n.º 25
0
//~~ bool OnInit() [StaircaseApp] ~~

StaircaseFrame *myFrame = new  StaircaseFrame(0, -1, wxS("Staircase Light"));
SetTopWindow(myFrame);
myFrame->Init();

return true;
Ejemplo n.º 26
0
CPanelLabGeneral::CPanelLabGeneral(
        wxWindow *parent) :
  nwxPanel(parent, wxID_ANY),
  m_pInfo(NULL),
  m_pMarker(NULL)
{
  vector<wxString> vsFileTypes;
  wxRadioButton *pRadio;
  m_pLabelVolumeName = new wxStaticText(this,wxID_ANY,wxEmptyString);
  m_pLabelKitName = new wxStaticText(this,wxID_ANY,wxEmptyString);
  m_pLabelLastUpdateUser = new wxStaticText(this,wxID_ANY,wxEmptyString);

  wxFont fn = m_pLabelVolumeName->GetFont();
  fn.SetWeight(wxFONTWEIGHT_BOLD);
  m_pLabelVolumeName->SetFont(fn);
  m_pLabelKitName->SetFont(fn);

  m_pChoiceILS = new wxChoice(this,wxID_ANY);

  int nFileTypeStyle = wxRB_GROUP;
  int nSizerStyle = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
  wxBoxSizer *pSizerRadioFileType = new wxBoxSizer(wxHORIZONTAL);
  CDirList::GetTypes(&vsFileTypes);
  m_vpRadioFileType.reserve(vsFileTypes.size());
  for(vector<wxString>::iterator itr = vsFileTypes.begin();
    itr != vsFileTypes.end();
    ++itr)
  {
    pRadio = new wxRadioButton(
      this,
      wxID_ANY, 
      *itr,
      wxDefaultPosition, 
      wxDefaultSize, 
      nFileTypeStyle);
    pSizerRadioFileType->Add(pRadio,0,nSizerStyle,ID_BORDER << 1);
    nFileTypeStyle = 0;
    nSizerStyle = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT;
    m_vpRadioFileType.push_back(pRadio);
  }

  m_pRadioRaw = new wxRadioButton(
      this,
      wxID_ANY, 
      CParmOsiris::LABEL_DATA_RAW,
      wxDefaultPosition, 
      wxDefaultSize, 
      wxRB_GROUP);
  m_pRadioAnalyzed = new wxRadioButton(
      this,
      wxID_ANY,
      CParmOsiris::LABEL_DATA_ANALYZED,
      wxDefaultPosition,
      wxDefaultSize);

  m_pCheckUserOverride = new wxCheckBox(this,wxID_ANY, ALLOW_USER_OVERRIDE);
  m_pTextProtocol = new wxTextCtrl(this, wxID_ANY);
  m_pTextLot = new wxTextCtrl(this,wxID_ANY);
  m_pTextNotes = new wxTextCtrl(this,wxID_ANY,
    wxEmptyString, wxDefaultPosition,
    wxDefaultSize, wxTE_MULTILINE);

  wxGridBagSizer *pGridSizer = new wxGridBagSizer(ID_BORDER,ID_BORDER);
  wxGBPosition gbPos(0,0);
  _AddLine(wxS(VOLUME_STRING) wxS(" Name: "),m_pLabelVolumeName,pGridSizer, &gbPos);
  _AddLine(wxS("Reagent Kit: "),m_pLabelKitName,pGridSizer, &gbPos);
  _AddLine(wxS("Last Update: "),m_pLabelLastUpdateUser, pGridSizer, &gbPos);
  _AddLine(wxS("File Type: "), pSizerRadioFileType,pGridSizer,&gbPos);

  wxBoxSizer *pSizerRadio = new wxBoxSizer(wxHORIZONTAL);
  pSizerRadio->Add(m_pRadioRaw,0,wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
  pSizerRadio->Add(m_pRadioAnalyzed,0,wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT,ID_BORDER << 1);
  _AddLine(wxS("Data:"),pSizerRadio,pGridSizer,&gbPos);
  _AddLine(wxS("Internal Lane Standard: "), m_pChoiceILS,pGridSizer,&gbPos);

  {
    wxGBSpan gbSpan(1,2);
    int nRow = gbPos.GetRow();
    pGridSizer->Add(
      m_pCheckUserOverride,gbPos, gbSpan,
      wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT,
      ID_BORDER);
    gbPos.SetRow(++nRow);
  }


  _AddLine(wxS("Protocol: "), m_pTextProtocol,pGridSizer, &gbPos);
  _AddLine(wxS("Lot Nr.: "), m_pTextLot, pGridSizer, &gbPos);

  wxBoxSizer *pSizer = new wxBoxSizer(wxVERTICAL);
  pSizer->Add(pGridSizer,0,wxEXPAND | wxALL, ID_BORDER);
  pSizer->Add(
    new wxStaticText(this,wxID_ANY,"Notes:"),
    0,wxLEFT | wxTOP | wxBOTTOM | wxALIGN_LEFT, ID_BORDER);
  pSizer->Add(m_pTextNotes,1,wxEXPAND | (wxALL ^ wxTOP), ID_BORDER);
  SetSizer(pSizer);
  // do not Layout() because TransferDataToWindow() will modify the sizes
}
Ejemplo n.º 27
0
    Append(_ID(IDmenuPlotRemove),
      "Remove plot",
      "Remove this plot, keep all others");
    Append(_ID(IDmenuPlotRemoveOthers),
      "Remove other plots",
      "Remove all plots except this");
  }
  else
  {
    Append(IDMaxLadderLabels,
      LABEL_MAX_PEAK_LABELS,
      STATUS_MAX_PEAK_LABELS);
  }
}
const wxChar * const CMenuPlot::LABEL_MAX_PEAK_LABELS =
  wxS("Max. ladder peak labels...");
const wxChar * const CMenuPlot::STATUS_MAX_PEAK_LABELS =
  wxS("Set the maximum number of labels for ladder peaks");



void CMenuPlot::EnableLabelMenu(bool bEnable)
{
  m_pMenuItemLabels->Enable(bEnable);
}
bool CMenuPlot::IsLabelMenuEnabled()
{
  return m_pMenuItemLabels->IsEnabled();
}

bool CMenuPlot::AnalyzedValue()
Ejemplo n.º 28
0
 // do show the message in the text control
 void ShowLogMessage(const wxString& message)
 {
     m_pTextCtrl->AppendText(message + wxS('\n'));
 }
Ejemplo n.º 29
0
void wxCurlTransferDialog::CreateControls(const wxString &url, const wxString &msg, 
                                      const wxString &sizeLabel, const wxBitmap &bitmap)
{
    wxBoxSizer* main = new wxBoxSizer(wxVERTICAL);

    // message row
    if (!msg.IsEmpty())
    {
        wxStaticText *st = new wxStaticText( this, wxID_STATIC, msg );
        st->SetMinSize(wxSize(MINWIDTH, -1));
        main->Add(st, 0, wxLEFT|wxTOP|wxRIGHT|wxBOTTOM|wxGROW, OUTER_BORDER);
    }

    // URL row
    if (HasFlag(wxCTDS_URL))
    {
        wxBoxSizer* downloading = new wxBoxSizer(wxHORIZONTAL);

        wxStaticText *st = new wxStaticText( this, wxID_STATIC, _("URL:") );
        wxFont boldFont(st->GetFont());
        boldFont.SetWeight(wxFONTWEIGHT_BOLD);
        st->SetFont(boldFont);
        downloading->Add(st, 0, wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, BORDER);

        m_pURL = new wxStaticText( this, wxID_STATIC, url, wxDefaultPosition,
                                   wxSize(MINWIDTH, -1));//, wxST_ELLIPSIZE_MIDDLE);
        downloading->Add(m_pURL, 1, wxALIGN_CENTER_VERTICAL|wxTOP, BORDER);

        main->Add(downloading, 0, wxGROW|wxLEFT|wxRIGHT, OUTER_BORDER);
        main->AddSpacer(5);
    }


    wxSizer *leftcolumn = new wxBoxSizer(wxVERTICAL);

    // speed & size row
    if (HasFlag(wxCTDS_SPEED))
        m_pSpeed = AddSizerRow(leftcolumn, wxS("Speed:"));
    if (HasFlag(wxCTDS_SIZE))
        m_pSize = AddSizerRow(leftcolumn, sizeLabel);

    // a spacer
    leftcolumn->AddSpacer(5);

    // the time rows
    if (HasFlag(wxCTDS_ELAPSED_TIME))
        m_pElapsedTime = AddSizerRow(leftcolumn, wxS("Elapsed time:"));
    if (HasFlag(wxCTDS_ESTIMATED_TIME))
        m_pEstimatedTime = AddSizerRow(leftcolumn, wxS("Estimated total time:"));
    if (HasFlag(wxCTDS_REMAINING_TIME))
        m_pRemainingTime = AddSizerRow(leftcolumn, wxS("Estimated remaining time:"));

    if (bitmap.IsOk())
    {
        wxSizer *rightcolumn = new wxBoxSizer(wxVERTICAL);
        rightcolumn->Add( new wxStaticBitmap(this, wxID_ANY, bitmap),
                          0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, BORDER);

        wxSizer *both = new wxBoxSizer(wxHORIZONTAL);
        both->Add(leftcolumn);
        both->Add(rightcolumn, 1, wxGROW);
        main->Add(both, 0, wxGROW);
    }
    else
        main->Add(leftcolumn);


    // the gauge
    // VERY IMPORTANT: we set as range 101 so that when, because of some approximation,
    //                 the update event handler will SetValue(100), while the transfer
    //                 is not yet complete, the gauge will not appear completely filled.
    m_pGauge = new wxGauge( this, wxID_ANY, 101 );

    main->AddSpacer(5);
    main->Add(m_pGauge, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, OUTER_BORDER);

    // do we need to use wxCurlConnectionSettingsDialog?
    bool needsConnSettings = HasFlag(wxCTDS_CONN_SETTINGS_AUTH) ||
                             HasFlag(wxCTDS_CONN_SETTINGS_PORT) ||
                             HasFlag(wxCTDS_CONN_SETTINGS_PROXY);

    // an horizontal line of buttons
    if (HasFlag(wxCTDS_CAN_ABORT) || HasFlag(wxCTDS_CAN_PAUSE) || HasFlag(wxCTDS_CAN_START) ||
        needsConnSettings)
    {
        main->AddStretchSpacer(1);
        main->AddSpacer(BORDER*2);
        main->Add( new wxStaticLine(this), 0, wxGROW|wxLEFT|wxRIGHT, OUTER_BORDER);

        // the button row
        wxBoxSizer *btn = new wxBoxSizer(wxHORIZONTAL);

        if (HasFlag(wxCTDS_CAN_ABORT))
            btn->Add(new wxButton( this, AbortButtonId, _("Abort") ), 0, wxRIGHT, BORDER);
        if (needsConnSettings)
            btn->Add(new wxButton( this, ConnSettingsButtonId, _("Settings") ), 0);

        btn->AddStretchSpacer(1);

        if (HasFlag(wxCTDS_CAN_PAUSE))
            btn->Add(new wxButton( this, PauseResumeButtonId, _("Pause") ), 0);
        if (HasFlag(wxCTDS_CAN_START))
            btn->Add(new wxButton( this, StartButtonId, _("Start") ), 0, wxLEFT, BORDER);

        btn->SetMinSize( wxSize( -1, wxButton::GetDefaultSize().GetHeight() + 2 * OUTER_BORDER ) );

        main->Add(btn, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, OUTER_BORDER);
    }

    this->SetSizerAndFit(main);
    main->SetSizeHints(this);
}
Ejemplo n.º 30
0
bool wxCurlDAVTool::ParsePropsXml(wxCurlDAVFs& fsItem, wxXmlNode* pNode)
{
	if(pNode->GetName().Find(wxS("prop")) != -1)
	{
		wxXmlNode* pChild = pNode->GetChildren();

		bool bFoundCreationDate = false;
		bool bFoundLastModified = false;
		bool bFoundGetContentLength = false;
		bool bFoundGetContentType = false;

		while(pChild)
		{
			if(pChild->GetName().Find(wxS("creationdate")) != -1)
			{
				wxXmlNode* pText = pChild->GetChildren();

				while(pText)
				{
					if(pText->GetType() == wxXML_TEXT_NODE)
					{
						wxString szVal = pText->GetContent();

						fsItem.m_dtCreationDate.ParseFormat(szVal, wxS("%Y-%m-%dT%H:%M:%S"));
						bFoundCreationDate = true;
					}

					pText = pText->GetNext();
				}
			}

			if(pChild->GetName().Find(wxS("getlastmodified")) != -1)
			{
				wxXmlNode* pText = pChild->GetChildren();

				while(pText)
				{
					if(pText->GetType() == wxXML_TEXT_NODE)
					{
						wxString szVal = pText->GetContent();

						fsItem.m_dtLastModified.ParseRfc822Date(szVal);
						bFoundLastModified = true;
					}

					pText = pText->GetNext();
				}
			}

			if(pChild->GetName().Find(wxS("getcontentlength")) != -1)
			{
				wxXmlNode* pText = pChild->GetChildren();

				while(pText)
				{
					if(pText->GetType() == wxXML_TEXT_NODE)
					{
						wxString szVal = pText->GetContent();

						if(szVal.ToLong(&fsItem.m_iContentLength))
							bFoundGetContentLength = true;
					}

					pText = pText->GetNext();
				}
			}

			if(pChild->GetName().Find(wxS("getcontenttype")) != -1)
			{
				wxXmlNode* pText = pChild->GetChildren();

				while(pText)
				{
					if(pText->GetType() == wxXML_TEXT_NODE)
					{
						fsItem.m_szContentType = pText->GetContent();
						bFoundGetContentType = true;
					}

					pText = pText->GetNext();
				}
			}

			pChild = pChild->GetNext();
		}

		return bFoundCreationDate && bFoundLastModified;
	}

	return false;
}