pkgsrc-WIP-review archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wip/qcad build fails on MacOS X 10.3.9



John D. Baker, KN5UKS, reported:

> Building wip/qcad (qcad-2.0.4.0-1) on MacOS X 10.3.9 fails as follows:
>
> [...]
> main.cpp:34:27: qmacstyle_mac.h: No such file or directory
>
> I suspect the missing "qmacstyle_mac.h" is due to the dectection of
> MacOS X, and an expectation to build the MacOS/Aqua/Cocoa version of
> the program.
>
> For use in pkgsrc, there needs to be a patch that causes MacOS X to be
> equivalent to Darwin and thus build the regular X11 version.

ok... The #include of qmacstyle_mac.h is conditioned on the preprocessor
symbol __APPLE__.  There are 11 source files that condition something on that
symbol. My first instinct is to try to get a vanilla pkgsrc/darwin/X11 build
by simply eliminating *all* of the __APPLE__-specific code, either by patching
all the conditionals to #if 0/#if 1, or just patching the Makefile to pass -U
__APPLE__ to the compiler/preprocessor.

hmm... looks like -U __APPLE__ won't be as easy as I thought, because the
qmake-generated makefiles won't propagate it. So, it'll be a matter of
patching out the ifdef/ifndefs. Next I need to decide whether to patch them
*all* out, or to try to be selective.

In the rest of this message are my notes on what all of the __APPLE__-specific
code seems to be doing.  Could someone who knows MacOS X better than I do, or
has access to it for testing, offer an opinion whether any of these
conditional blocks looks to be worth NOT patching out?

Thanks,
-Chap


:::qcad/src/main.cpp :::

This is the conditional include that fails:

#ifdef __APPLE__
#include <qmacstyle_mac.h>
#endif

and further below:

#ifdef __APPLE__
        QApplication::setStyle(new QMacStyle());
#endif



::: qcad/src/qc_applicationwindow.cpp :::

Here it seems that for most platforms, menuBar() returns the menubar on which
a new menu should be inserted, but for APPLE we save the initial value of menu
and use that:

#ifdef __APPLE__

    QPopupMenu* m = menu;
#endif

    menu=new QPopupMenu(this);
    action = actionFactory.createAction(RS2::ActionDimAligned, actionHandler);
    action->addTo(menu);
...
#ifdef __APPLE__

    m->insertItem(tr("&Dimension"), menu);
#else

    menuBar()->insertItem(tr("&Dimension"), menu);
#endif

We also seem to enforce an APPLE-specific minimum size:

#ifdef __APPLE__

    if (windowY<30) {
        windowY=30;
    }
#endif



::: qcadactions/src/rs_actionmodifydeletequick.cpp :::

Here we seem to choose an APPLE-specific accel key for the Delete action.
Being accustomed to X, I would normally expect to be able to customize this
with an X resource. Is there anything in Qt that allows a user to tweak this
mapping without recompiling?  Should I keep this conditional, to get a
reasonable key mapping on a Mac keyboard? Will it be annoying if the user runs
QCad from another X server?

#ifdef __APPLE__
        QKeySequence s = Key_Backspace;
#else
        QKeySequence s = Key_Delete;
#endif



::: qcadactions/src/rs_actionzoompan.cpp :::

Apparently for APPLE there is nothing to do here:

void RS_ActionZoomPan::updateMouseCursor() {
#ifndef __APPLE__
    graphicView->setMouseCursor(RS2::SizeAllCursor);
#endif
}



::: qcadguiqt/src/qg_actionfactory.cpp :::

Here for APPLE we choose a different title for the application preferences
menu item. My assumption: if we are building as a vanilla X app rather than
an Aqua/Cocoa app, we want the vanilla X title.

    case RS2::ActionOptionsGeneral:
        action = new QAction(tr("Application"), QPixmap::fromMimeSource("configu
re.png"),
#ifdef __APPLE__
                                                         tr("&Preferences"),
#else
                             tr("&Application Preferences")+"...",
#endif
                             0, mw);


::: qcadguiqt/src/qg_graphicview.cpp :::

Here we avoid most individual mouse cursors for APPLE.  Again, I assume that
for a vanilla X app, there's no need to observe macx/Aqua/Cocoa restrictions
on cursors, and we should just build the vanilla way.

#ifndef __APPLE__
#include "xpm/cur_glass_bmp.xpm"
#include "xpm/cur_glass_mask.xpm"
#include "xpm/cur_cad_bmp.xpm"
#include "xpm/cur_cad_mask.xpm"
#include "xpm/cur_del_bmp.xpm"
#include "xpm/cur_del_mask.xpm"
#include "xpm/cur_select_bmp.xpm"
#include "xpm/cur_select_mask.xpm"
#include "xpm/cur_hand_bmp.xpm"
#include "xpm/cur_hand_mask.xpm"
#endif
...
#ifndef __APPLE__
    // Mouse Cursors:
    QBitmap bmp;
    QPixmap cur1(cur_cad_bmp_xpm);
    bmp = QPixmap(cur_cad_mask_xpm);
    cur1.setMask(bmp);
    curCad = new QCursor(cur1, 15, 15);

    QPixmap cur2(cur_glass_bmp_xpm);
    bmp = QPixmap(cur_glass_mask_xpm);
    cur2.setMask(bmp);
    curMagnifier = new QCursor(cur2, 12, 12);

    QPixmap cur3(cur_del_bmp_xpm);
    bmp = QPixmap(cur_del_mask_xpm);
    cur3.setMask(bmp);
    curDel = new QCursor(cur3, 15, 15);

    QPixmap cur4(cur_select_bmp_xpm);
    bmp = QPixmap(cur_select_mask_xpm);
    cur4.setMask(bmp);
    curSelect = new QCursor(cur4, 15, 15);

    QPixmap cur5(cur_hand_bmp_xpm);
    bmp = QPixmap(cur_hand_mask_xpm);
    cur5.setMask(bmp);
    curHand = new QCursor(cur5, 15, 15);
#else
    // No individual cursors for the Mac
    curCad = NULL;
    curMagnifier = NULL;
    curDel = NULL;
    curSelect = NULL;
    curHand = NULL;
#endif
...
#ifndef __APPLE__

    case RS2::CadCursor:
        setCursor(*curCad);
        break;
    case RS2::DelCursor:
        setCursor(*curDel);
        break;
    case RS2::SelectCursor:
        setCursor(*curSelect);
        break;
    case RS2::MagnifierCursor:
        setCursor(*curMagnifier);
        break;
    case RS2::MovingHandCursor:
        setCursor(*curHand);
        break;
#else
        // Reduced cursor selection for the Mac:
    case RS2::CadCursor:
        setCursor(Qt::CrossCursor);
        break;
    case RS2::DelCursor:
        setCursor(Qt::CrossCursor);
        break;
    case RS2::SelectCursor:
        setCursor(Qt::CrossCursor);
        break;
    case RS2::MagnifierCursor:
        setCursor(Qt::CrossCursor);
        break;
    case RS2::MovingHandCursor:
        setCursor(Qt::PointingHandCursor);
        break;
#endif



::: qcadguiqt/src/ui/qg_coordinatewidget.ui.h :::

A larger status bar font size for APPLE?

    int fsize;
#ifdef __APPLE__
    fsize = 9;
#else
    fsize = 7;
#endif

    RS_SETTINGS->beginGroup("/Appearance");
    fsize = RS_SETTINGS->readNumEntry("/StatusBarFontSize", fsize);
    RS_SETTINGS->endGroup();



::: qcadguiqt/src/ui/qg_mousewidget.ui.h :::

And again ...

    int fsize;
#ifdef __APPLE__
    fsize = 9;
#else
    fsize = 7;
#endif

    RS_SETTINGS->beginGroup("/Appearance");
    fsize = RS_SETTINGS->readNumEntry("/StatusBarFontSize", fsize);
    RS_SETTINGS->endGroup();



::: qcadguiqt/src/ui/qg_selectionwidget.ui.h :::

And again ...

    int fsize;
#ifdef __APPLE__
    fsize = 9;
#else
    fsize = 7;
#endif

    RS_SETTINGS->beginGroup("/Appearance");
    fsize = RS_SETTINGS->readNumEntry("/StatusBarFontSize", fsize);
    RS_SETTINGS->endGroup();



::: qcadlib/src/engine/rs_system.cpp :::

Alter the path for file searching. Non-APPLE, use this path for everything
(this is the path that's been patched to include @PREFIX@). APPLE, use it
for everything but library files, do something different for them. I'm
pretty sure in this case the non-APPLE behavior is best for pkgsrc; any
dissent?

#ifdef __APPLE__

    if (subDirectory!="library") {
#endif
        //local (application) directory has priority over other dirs:
        if (!appDir.isEmpty() && appDir!="/" && appDir!=getHomeDir()) {
            dirList.append(appDir + "/" + subDirectory);
        }

        dirList.append("@PREFIX@/share/" + appDirName + "/" + subDirectory);
        dirList.append(getHomeDir() + "/." + appDirName + "/" + subDirectory);

#ifdef __APPLE__

    }
#endif

#ifdef __APPLE__
    // Mac OS X - don't scan for library since this might lead us into the
    //  wrong directory tree:
    if (!appDir.isEmpty() && appDir!="/" /*&& subDirectory!="library"*/) {
        dirList.append(appDir + "/../Resources/" + subDirectory);
        dirList.append(appDir + "/../../../" + subDirectory);
    }
#endif



::: qcadlib/src/gui/rs_graphicview.cpp :::

Here there seems to be an APPLE-specific tweak to a delay loop used for
slowed-down simulated drawing (a function I didn't even know QCad had, and
am not sure how to use or test...)

void RS_GraphicView::simulationDelay(bool step) {
    int delay;
    RS_SETTINGS->beginGroup("/CAM");
    double fact = (double)RS_SETTINGS->readNumEntry("/SimulationFactor", 12000);
    RS_SETTINGS->endGroup();

    // simulationSpeed: 0..100

#ifdef __APPLE__
    delay = (int)(((1.0/(simulationSpeed+1.0)) * fact) - (fact/100.0));
    if (step) {
        delay*=16;
    }
    //usleep(delay);
    static int call=0;

    if (call>=(fact-delay)/1000) {
        call=0;
        for (int i=0; i<delay; ++i) {
           RS_APP->processEvents(10);
        }
    }
    else {
        call++;
    }
#else
    delay = (int)(((1.0/(simulationSpeed+1.0)) * fact) - (fact/100.0));
    if (step) {
        delay*=16;
    }
    for (int i=0; i<delay; ++i) {
        RS_APP->processEvents(10);
    }
#endif
}


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
pkgsrc-wip-review mailing list
pkgsrc-wip-review%lists.sourceforge.net@localhost
https://lists.sourceforge.net/lists/listinfo/pkgsrc-wip-review



Home | Main Index | Thread Index | Old Index