Ejemplo n.º 1
0
void MainWindow::systrayActivities(QSystemTrayIcon::ActivationReason reason) // If the user click on the systray icon, we show the window
{
    if(reason != QSystemTrayIcon::Context)
        setVisible(!isVisible());
}
Ejemplo n.º 2
0
bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
{
	if (GUIModalMenu::OnEvent(event))
		return true;

	if (event.EventType == EET_KEY_INPUT_EVENT && activeKey >= 0
			&& event.KeyInput.PressedDown) {
		
		bool prefer_character = shift_down;
		KeyPress kp(event.KeyInput, prefer_character);
		
		bool shift_went_down = false;
		if(!shift_down &&
				(event.KeyInput.Key == irr::KEY_SHIFT ||
				event.KeyInput.Key == irr::KEY_LSHIFT ||
				event.KeyInput.Key == irr::KEY_RSHIFT))
			shift_went_down = true;

		// Remove Key already in use message
		if(this->key_used_text)
		{
			this->key_used_text->remove();
			this->key_used_text = NULL;
		}
		// Display Key already in use message
		if (std::find(this->key_used.begin(), this->key_used.end(), kp) != this->key_used.end())
		{
			core::rect < s32 > rect(0, 0, 600, 40);
			rect += v2s32(0, 0) + v2s32(25, 30);
			const wchar_t *text = wgettext("Key already in use");
			this->key_used_text = Environment->addStaticText(text,
					rect, false, true, this, -1);
			delete[] text;
			//infostream << "Key already in use" << std::endl;
		}

		// But go on
		{
			key_setting *k = NULL;
			for(size_t i = 0; i < key_settings.size(); i++)
			{
				if(key_settings.at(i)->id == activeKey)
				{
					k = key_settings.at(i);
					break;
				}
			}
			FATAL_ERROR_IF(k == NULL, "Key setting not found");
			k->key = kp;
			const wchar_t *text = wgettext(k->key.name());
			k->button->setText(text);
			delete[] text;

			this->key_used.push_back(kp);

			// Allow characters made with shift
			if(shift_went_down){
				shift_down = true;
				return false;
			}else{
				activeKey = -1;
				return true;
			}
		}
	} else if (event.EventType == EET_KEY_INPUT_EVENT && activeKey < 0
			&& event.KeyInput.PressedDown
			&& event.KeyInput.Key == irr::KEY_ESCAPE) {
		quitMenu();
		return true;
	} else if (event.EventType == EET_GUI_EVENT) {
		if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST
			&& isVisible())
		{
			if (!canTakeFocus(event.GUIEvent.Element))
			{
				dstream << "GUIMainMenu: Not allowing focus change."
				<< std::endl;
				// Returning true disables focus change
				return true;
			}
		}
		if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED)
		{
			switch (event.GUIEvent.Caller->getID())
			{
				case GUI_ID_BACK_BUTTON: //back
					acceptInput();
					quitMenu();
					return true;
				case GUI_ID_ABORT_BUTTON: //abort
					quitMenu();
					return true;
				default:
					key_setting *k = NULL;
					for(size_t i = 0; i < key_settings.size(); i++)
					{
						if(key_settings.at(i)->id == event.GUIEvent.Caller->getID())
						{
							k = key_settings.at(i);
							break;
						}
					}
					FATAL_ERROR_IF(k == NULL, "Key setting not found");

					resetMenu();
					shift_down = false;
					activeKey = event.GUIEvent.Caller->getID();
					const wchar_t *text = wgettext("press key");
					k->button->setText(text);
					delete[] text;
					this->key_used.erase(std::remove(this->key_used.begin(),
							this->key_used.end(), k->key), this->key_used.end());
					break;
			}
			Environment->setFocus(this);
		}
	}
	return Parent ? Parent->OnEvent(event) : false;
}
Ejemplo n.º 3
0
// Overridden so that not touchable unless specifically set as such
bool CC3BoundingVolumeDisplayNode::isTouchable()
{
	return (isVisible() || m_shouldAllowTouchableWhenInvisible) && isTouchEnabled();
}
Ejemplo n.º 4
0
void SignalSlotConnection::updateVisibility()
{
    Connection::updateVisibility();
    if (isVisible() && (signal().isEmpty() || slot().isEmpty()))
        setVisible(false);
}
Ejemplo n.º 5
0
void ProcessorPage::on_stepBtn_clicked()
{
	processor->step();
	if(isVisible())
		updateInfo();
}
Ejemplo n.º 6
0
QString PlotCurve::saveCurveLayout()
{
    QString s = "<Style>" + QString::number(d_plot_style) + "</Style>\n";
    if (d_plot_style == Graph::Spline)
        s += "<LineStyle>5</LineStyle>\n";
    else if (d_plot_style == Graph::VerticalSteps)
        s += "<LineStyle>6</LineStyle>\n";
    else
        s += "<LineStyle>" + QString::number(this->style()) + "</LineStyle>\n";

    QPen pen = this->pen();
    if (pen.style() != Qt::NoPen) {
        s += "<Pen>\n";
        s += "\t<Color>" + pen.color().name() + "</Color>\n";
        if (pen.color().alpha() != 255)
            s += "\t<Alpha>" + QString::number(pen.color().alpha()) + "</Alpha>\n";
        s += "\t<Style>" + QString::number(pen.style()-1) + "</Style>\n";
        s += "\t<Width>" + QString::number(pen.widthF()) + "</Width>\n";
        s += "</Pen>\n";
    }

    QBrush brush = this->brush();
    if (brush.style() != Qt::NoBrush) {
        s += "<Brush>\n";
        s += "\t<Color>" + brush.color().name() + "</Color>\n";
        if (brush.color().alpha() != 255)
            s += "\t<Alpha>" + QString::number(brush.color().alpha()) + "</Alpha>\n";
        s += "\t<Style>" + QString::number(PatternBox::patternIndex(brush.style())) + "</Style>\n";
        s += "</Brush>\n";
    }

    const QwtSymbol symbol = this->symbol();
    if (symbol.style() != QwtSymbol::NoSymbol) {
        s += "<Symbol>\n";
        s += "\t<Style>" + QString::number(SymbolBox::symbolIndex(symbol.style())) + "</Style>\n";
        s += "\t<Size>" + QString::number(symbol.size().width()) + "</Size>\n";

        s += "\t<SymbolPen>\n";
        s += "\t\t<Color>" + symbol.pen().color().name() + "</Color>\n";
        if (symbol.pen().color().alpha() != 255)
            s += "\t<Alpha>" + QString::number(symbol.pen().color().alpha()) + "</Alpha>\n";
        s += "\t\t<Width>" + QString::number(symbol.pen().widthF()) + "</Width>\n";
        s += "\t</SymbolPen>\n";

        brush = this->brush();
        if (brush.style() != Qt::NoBrush) {
            s += "\t<SymbolBrush>\n";
            s += "\t\t<Color>" + symbol.brush().color().name() + "</Color>\n";
            if (symbol.brush().color().alpha() != 255)
                s += "\t<Alpha>" + QString::number(symbol.brush().color().alpha()) + "</Alpha>\n";
            s += "\t\t<Style>" + QString::number(PatternBox::patternIndex(symbol.brush().style())) + "</Style>\n";
            s += "\t</SymbolBrush>\n";
        }
        s += "</Symbol>\n";
    }
    s += "<xAxis>" + QString::number(xAxis()) + "</xAxis>\n";
    s += "<yAxis>" + QString::number(yAxis()) + "</yAxis>\n";
    s += "<CurveType>" + QString::number(curveType()) + "</CurveType>\n";
    s += "<Visible>" + QString::number(isVisible()) + "</Visible>\n";
    return s;
}
Ejemplo n.º 7
0
void LabelCanvas::draw(QPainter & p)
{
    if (! isVisible()) return;

    p.setRenderHint(QPainter::Antialiasing, true);
    p.setBackgroundMode(::Qt::TransparentMode);

    QRectF r = boundingRect();
    FILE * fp = svg();
    int index = text().indexOf(Triangle);

    if (fp != 0)
        fputs("<g>\n", fp);

    if (index == 0) {
        // triangle only
        int w = width() / 2 - 1;
        int b = r.bottom();
        int cx = (r.left() + r.right()) / 2;

        p.drawLine(cx - w, b, cx + w, b);
        //p.lineTo(cx, (int) y());
        p.drawLine(cx + w, b, cx, (int) y());
        //p.lineTo(cx - w, b);
        p.drawLine(cx, (int)y(), cx - w, b);

        if (fp != 0)
            fprintf(fp, "\t<polygon fill=\"none\" stroke=\"black\" stroke-opacity=\"1\""
                    " points=\"%d,%d %d,%d %d,%d\" />\n",
                    cx - w, b, cx + w, b, cx, (int) y());
    }
    else if (index != -1) {
        // label then triangle under
        p.setFont(font());
        p.drawText(rect(), ::Qt::AlignHCenter, text().mid(0, index - 1));

        if (fp != 0)
            draw_text(rect(), ::Qt::AlignHCenter, text().mid(0, index - 1),
                      p.font(), fp);

        QFontMetrics fm(font());
        int w = fm.width(Triangle) / 2 - 1;
        int cx = (r.left() + r.right()) / 2;
        int cy = (int) y() + fm.height();
        int b = r.bottom();

        p.drawLine(cx - w, b, cx + w, b);
        //p.lineTo(cx, cy);
        p.drawLine(cx + w, b, cx, cy);
        //p.lineTo(cx - w, b);
        p.drawLine(cx, cy, cx - w, b);

        if (fp != 0)
            fprintf(fp, "\t<polygon fill=\"none\" stroke=\"black\" stroke-opacity=\"1\""
                    " points=\"%d,%d %d,%d %d,%d\" />\n",
                    cx - w, b, cx + w, b, cx, cy);
    }
    else if (text() != Zigzag) {
        // no triangle nor zigzag
        if (text().indexOf('\n') != -1) {
            p.setFont(font());

            int flg = (multi_lines_centered) ? ::Qt::AlignHCenter : 0;

            p.drawText(rect(), flg, text().mid(0, index - 1));

            if (fp != 0)
                draw_text(rect(), flg, text().mid(0, index - 1),
                          p.font(), fp);
        }
        else {
            QStyleOptionGraphicsItem option;
            QGraphicsSimpleTextItem::paint(&p,&option,0);

            if (fp != 0)
                draw_text(rect(), 0, text(), p.font(), fp);
        }
    }
    else {
        // zigzag (only used as stereotype)
        int t = r.top() + 2;
        int h = height() - 2;
        int yb = r.bottom() - h / 4;
        int xr = r.right() - r.width() / 4;

        p.drawLine(r.left(), t, r.right(), t);
        //p.lineTo(r.left(), yb);
        p.drawLine(r.right(), t, r.left(), yb);
        //p.lineTo(r.right(), yb);
        p.drawLine(r.left(), yb, r.right(), yb);
        //p.lineTo(xr, r.bottom() - h / 2);
        p.drawLine(r.right(), yb, xr, r.bottom() - h / 2);
        p.drawLine(r.right(), yb, xr, r.bottom());

        if (fp != 0) {
            fprintf(fp, "\t<polyline fill=\"none\" stroke=\"black\" stroke-opacity=\"1\""
                    " points=\"%f,%d %f,%d %f,%d %f,%d %d,%f\" />\n",
                    r.left(), t, r.right(), t, r.left(), yb, r.right(), yb, xr, r.bottom() - h / 2);
            fprintf(fp, "\t<line stroke=\"black\" stroke-opacity=\"1\""
                    " x1=\"%f\" y1=\"%d\" x2=\"%d\" y2=\"%f\" />\n",
                    r.right(), yb, xr, r.bottom());
        }
    }

    if (fp != 0)
        fputs("</g>\n", fp);

    if (isSelected())
        show_mark(p, r.toRect());
}
Ejemplo n.º 8
0
// Returns "distance" between target destination and resulting xfrom
F32 LLDrawable::updateXform(BOOL undamped)
{
	BOOL damped = !undamped;

	// Position
	LLVector3 old_pos(mXform.getPosition());
	LLVector3 target_pos;
	if (mXform.isRoot())
	{
		// get root position in your agent's region
		target_pos = mVObjp->getPositionAgent();
	}
	else
	{
		// parent-relative position
		target_pos = mVObjp->getPosition();
	}
	
	// Rotation
	LLQuaternion old_rot(mXform.getRotation());
	LLQuaternion target_rot = mVObjp->getRotation();
	//scaling
	LLVector3 target_scale = mVObjp->getScale();
	LLVector3 old_scale = mCurrentScale;
	LLVector3 dest_scale = target_scale;
	
	// Damping
	F32 dist_squared = 0.f;
	F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera);

	if (damped && isVisible())
	{
		F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
		LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt);
		dist_squared = dist_vec_squared(new_pos, target_pos);

		LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
		dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f;

		LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
		dist_squared += dist_vec_squared(new_scale, target_scale);

		if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) &&
			(dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED))
		{
			// interpolate
			target_pos = new_pos;
			target_rot = new_rot;
			target_scale = new_scale;
		}
		else
		{
			// snap to final position
			dist_squared = 0.0f;
			if (getVOVolume() && !isRoot())
			{ //child prim snapping to some position, needs a rebuild
				gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
			}
		}
	}

	if ((mCurrentScale != target_scale) ||
		(!isRoot() && 
		 (dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED || 
		 !mVObjp->getAngularVelocity().isExactlyZero() ||
		 target_pos != mXform.getPosition() ||
		 target_rot != mXform.getRotation())))
	{ //child prim moving or scale change requires immediate rebuild
		gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
	}
	else if (!getVOVolume() && !isAvatar())
	{
		movePartition();
	}

	// Update
	mXform.setPosition(target_pos);
	mXform.setRotation(target_rot);
	mXform.setScale(LLVector3(1,1,1)); //no scale in drawable transforms (IT'S A RULE!)
	mXform.updateMatrix();
	
	mCurrentScale = target_scale;
	
	if (mSpatialBridge)
	{
		gPipeline.markMoved(mSpatialBridge, FALSE);
	}
	return dist_squared;
}
Ejemplo n.º 9
0
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
{
    struct divecomputer *dc = NULL;

    if (d)
        dc = select_dc(&d->dc);

    if (!forceRedraw && dive == d && (d && dc == diveDC))
        return;

    clear();
    dive = d;
    diveDC = d ? dc : NULL;

    if (!isVisible() || !dive || !mainWindow()) {
        return;
    }
    setBackgroundBrush(getColor(BACKGROUND));

    // best place to put the focus stealer code.
    setFocusProxy(mainWindow()->dive_list());
    scene()->setSceneRect(0,0, viewport()->width()-50, viewport()->height()-50);

    toolTip = new ToolTipItem();
    installEventFilter(toolTip);
    scene()->addItem(toolTip);
    if (printMode)
        toolTip->setVisible(false);

    // Fix this for printing / screen later.
    // plot_set_scale(scale_mode_t);

    if (!dc || !dc->samples) {
        dc = fake_dc(dc);
    }

    QString nick = get_dc_nickname(dc->model, dc->deviceid);
    if (nick.isEmpty())
        nick = QString(dc->model);

    if (nick.isEmpty())
        nick = tr("unknown divecomputer");

    if ( tr("unknown divecomputer") == nick) {
        mode = PLAN;
    } else {
        mode = DIVE;
    }

    /*
     * Set up limits that are independent of
     * the dive computer
     */
    calculate_max_limits(dive, dc, &gc);

    QRectF profile_grid_area = scene()->sceneRect();
    gc.maxx = (profile_grid_area.width() - 2 * profile_grid_area.x());
    gc.maxy = (profile_grid_area.height() - 2 * profile_grid_area.y());

    /* This is per-dive-computer */
    gc.pi = *create_plot_info(dive, dc, &gc);

    /* Bounding box */
    QPen pen = defaultPen;
    pen.setColor(getColor(TIME_GRID));
    QGraphicsRectItem *rect = new QGraphicsRectItem(profile_grid_area);
    rect->setPen(pen);
    scene()->addItem(rect);

    /* Depth profile */
    plot_depth_profile();
    plot_events(dc);

    if (rulerEnabled && !printMode)
        create_ruler();

    /* Temperature profile */
    plot_temperature_profile();

    /* Cylinder pressure plot */
    plot_cylinder_pressure();

    /* Text on top of all graphs.. */
    plot_temperature_text();
    plot_depth_text();
    plot_cylinder_pressure_text();
    plot_deco_text();

    /* Put the dive computer name in the lower left corner */
    gc.leftx = 0;
    gc.rightx = 1.0;
    gc.topy = 0;
    gc.bottomy = 1.0;

    text_render_options_t computer = {DC_TEXT_SIZE, TIME_TEXT, LEFT, TOP};
    diveComputer = plot_text(&computer, QPointF(gc.leftx, gc.bottomy), nick);
    // The Time ruler should be right after the DiveComputer:
    timeMarkers->setPos(0, diveComputer->y());

    if (PP_GRAPHS_ENABLED) {
        plot_pp_gas_profile();
        plot_pp_text();
    }

    plot_depth_scale();

#if 0
    if (gc->printer) {
        free(pi->entry);
        last_pi_entry = pi->entry = NULL;
        pi->nr = 0;
    }
#endif

    QRectF r = scene()->itemsBoundingRect();
    scene()->setSceneRect(r.x() - 15, r.y() -15, r.width() + 30, r.height() + 30);
    if (zoomLevel == 0) {
        fitInView(sceneRect());
    }
    toolTip->readPos();

    if(mode == PLAN) {
        timeEditor = new GraphicsTextEditor();
        timeEditor->setPlainText( dive->duration.seconds ? QString::number(dive->duration.seconds/60) : tr("Set Duration: 10 minutes"));
        timeEditor->setPos(profile_grid_area.width() - timeEditor->boundingRect().width(), timeMarkers->y());
        timeEditor->document();
        connect(timeEditor, SIGNAL(editingFinished(QString)), this, SLOT(edit_dive_time(QString)));
        scene()->addItem(timeEditor);
    }

    if (!printMode)
        addControlItems();

    if (rulerEnabled && !printMode)
        add_ruler();
}
Ejemplo n.º 10
0
void QueueLabel::slotCoverChanged( const QString &artist, const QString &album ) //SLOT
{
    PLItemList &queue = Playlist::instance()->m_nextTracks;
    if( isVisible() && queue.getFirst()->artist().string() == artist && queue.getFirst()->album().string() == album )
        getCover( artist, album );
}
Ejemplo n.º 11
0
void LeafNode::hoverEnterEvent(QGraphicsSceneHoverEvent*) {
  if (isVisible()) {
    m_text->setVisible(true);
  }
}
Ejemplo n.º 12
0
bool GUIMainMenu::OnEvent(const SEvent& event)
{
	if(event.EventType==EET_KEY_INPUT_EVENT)
	{
		if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
		{
			m_gamecallback->exitToOS();
			quitMenu();
			return true;
		}
		if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
		{
			acceptInput();
			quitMenu();
			return true;
		}
	}
	if(event.EventType==EET_GUI_EVENT)
	{
		if(event.GUIEvent.EventType==gui::EGET_ELEMENT_FOCUS_LOST
				&& isVisible())
		{
			if(!canTakeFocus(event.GUIEvent.Element))
			{
				dstream<<"GUIMainMenu: Not allowing focus change."
						<<std::endl;
				// Returning true disables focus change
				return true;
			}
		}
		if(event.GUIEvent.EventType==gui::EGET_TAB_CHANGED)
		{
			if(!m_is_regenerating)
				regenerateGui(m_screensize_old);
			return true;
		}
		if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED)
		{
			switch(event.GUIEvent.Caller->getID())
			{
			case GUI_ID_JOIN_GAME_BUTTON: {
				MainMenuData cur;
				readInput(&cur);
				if(cur.address == L"" && getTab() == TAB_MULTIPLAYER){
					(new GUIMessageMenu(env, parent, -1, menumgr,
							wgettext("Address required."))
							)->drop();
					return true;
				}
				acceptInput();
				quitMenu();
				return true;
			}
			case GUI_ID_CHANGE_KEYS_BUTTON: {
				GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(env, parent, -1,menumgr);
				kmenu->drop();
				return true;
			}
			case GUI_ID_DELETE_WORLD_BUTTON: {
				MainMenuData cur;
				readInput(&cur);
				if(cur.selected_world == -1){
					(new GUIMessageMenu(env, parent, -1, menumgr,
							wgettext("Cannot delete world: Nothing selected"))
							)->drop();
				} else {
					WorldSpec spec = m_data->worlds[cur.selected_world];
					// Get files and directories involved
					std::vector<std::string> paths;
					paths.push_back(spec.path);
					fs::GetRecursiveSubPaths(spec.path, paths);
					// Launch confirmation dialog
					ConfirmDestDeleteWorld *dest = new
							ConfirmDestDeleteWorld(spec, this, paths);
					std::wstring text = wgettext("Delete world");
					text += L" \"";
					text += narrow_to_wide(spec.name);
					text += L"\"?\n\n";
					text += wgettext("Files to be deleted");
					text += L":\n";
					for(u32 i=0; i<paths.size(); i++){
						if(i == 3){ text += L"..."; break; }
						text += narrow_to_wide(paths[i]) + L"\n";
					}
					(new GUIConfirmMenu(env, parent, -1, menumgr, dest,
							text.c_str()))->drop();
				}
				return true;
			}
			case GUI_ID_CREATE_WORLD_BUTTON: {
				std::vector<SubgameSpec> games = getAvailableGames();
				if(games.size() == 0){
					GUIMessageMenu *menu = new GUIMessageMenu(env, parent,
							-1, menumgr,
							wgettext("Cannot create world: No games found"));
					menu->drop();
				} else {
					CreateWorldDest *dest = new CreateWorldDestMainMenu(this);
					GUICreateWorld *menu = new GUICreateWorld(env, parent, -1,
							menumgr, dest, games);
					menu->drop();
				}
				return true;
			}
			case GUI_ID_CONFIGURE_WORLD_BUTTON: {
				GUIMessageMenu *menu = new GUIMessageMenu(env, parent,
						-1, menumgr,
						wgettext("Nothing here"));
				menu->drop();
				return true;
			}
			}
		}
		if(event.GUIEvent.EventType==gui::EGET_EDITBOX_ENTER)
		{
			switch(event.GUIEvent.Caller->getID())
			{
				case GUI_ID_ADDRESS_INPUT: case GUI_ID_PORT_INPUT: case GUI_ID_NAME_INPUT: case 264:
				acceptInput();
				quitMenu();
				return true;
			}
		}
		if(event.GUIEvent.EventType==gui::EGET_LISTBOX_SELECTED_AGAIN)
		{
			switch(event.GUIEvent.Caller->getID())
			{
			case GUI_ID_WORLD_LISTBOX:
				acceptInput();
				if(getTab() != TAB_SINGLEPLAYER)
					m_data->address = L""; // Force local game
				quitMenu();
				return true;
			}
		}
	}

	return Parent ? Parent->OnEvent(event) : false;
}
Ejemplo n.º 13
0
void DkCompressDialog::drawPreview() {

	if (mImg.isNull() || !isVisible())
		return;

	QImage origImg = mOrigView->getCurrentImageRegion();
	qDebug() << "orig img size: " << origImg.size();
	qDebug() << "min size: " << mOrigView->minimumSize();
	mNewImg = QImage(origImg.size(), QImage::Format_ARGB32);

	if ((mDialogMode == jpg_dialog || mDialogMode == j2k_dialog) && mHasAlpha)
		mNewImg.fill(mBgCol.rgb());
	else if ((mDialogMode == jpg_dialog || mDialogMode == web_dialog) && !mHasAlpha)
		mNewImg.fill(palette().color(QPalette::Background).rgb());
	else
		mNewImg.fill(QColor(0,0,0,0).rgba());
	 
	QPainter bgPainter(&mNewImg);
	bgPainter.drawImage(origImg.rect(), origImg, origImg.rect());
	bgPainter.end();

	if (mDialogMode == jpg_dialog) {
		// pre-compute the jpg compression
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::ReadWrite);
		mNewImg.save(&buffer, "JPG", mSlider->value());
		mNewImg.loadFromData(ba, "JPG");
		updateFileSizeLabel((float)ba.size(), origImg.size());
	}
	else if (mDialogMode == j2k_dialog) {
		// pre-compute the jpg compression
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::ReadWrite);
		mNewImg.save(&buffer, "J2K", mSlider->value());
		mNewImg.loadFromData(ba, "J2K");
		updateFileSizeLabel((float)ba.size(), origImg.size());
		qDebug() << "using j2k...";
	}
	else if (mDialogMode == webp_dialog && getCompression() != -1) {
		// pre-compute the jpg compression
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::ReadWrite);
		mNewImg.save(&buffer, "WEBP", mSlider->value());
		mNewImg.loadFromData(ba, "WEBP");
		updateFileSizeLabel((float)ba.size(), origImg.size());
		qDebug() << "using webp...";

		//// pre-compute the webp compression
		//DkBasicLoader loader;
		//QSharedPointer<QByteArray> buffer(new QByteArray());
		//loader.saveWebPFile(mNewImg, buffer, getCompression(), 0);
		//qDebug() << "webP buffer size: " << buffer->size();
		//loader.loadWebPFile(QString(), buffer);
		//mNewImg = loader.image();
		//updateFileSizeLabel((float)buffer->size(), origImg.size());
	}
	else if (mDialogMode == web_dialog) {

		float factor = getResizeFactor();
		if (factor != -1)
			mNewImg = DkImage::resizeImage(mNewImg, QSize(), factor, DkImage::ipl_area);

		if (!mHasAlpha) {
			// pre-compute the jpg compression
			QByteArray ba;
			QBuffer buffer(&ba);
			buffer.open(QIODevice::ReadWrite);
			mNewImg.save(&buffer, "JPG", getCompression());
			mNewImg.loadFromData(ba, "JPG");
			updateFileSizeLabel((float)ba.size(), origImg.size(), factor);
		}
		else
			updateFileSizeLabel();
	}
	else
		updateFileSizeLabel();

	//previewLabel->setScaledContents(true);
	QImage img = mNewImg.scaled(mPreviewLabel->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
	mPreviewLabel->setPixmap(QPixmap::fromImage(img));
}
void issueLineToShipping::sIssue()
{
  XSqlQuery issueIssue;
  if (_qtyToIssue->toDouble() <= 0)
  {
    XMessageBox::message( (isVisible() ? this : parentWidget()), QMessageBox::Warning, tr("Invalid Quantity to Issue to Shipping"),
                          tr(  "<p>Please enter a non-negative, non-zero value to indicate the amount "
                               "of Stock you wish to Issue to Shipping for this Order Line." ),
                          QString::null, QString::null, _snooze );
    _qtyToIssue->setFocus();
    return;
  }

  if(_requireInventory || ("SO" == _ordertype && _metrics->boolean("EnableSOReservations")))
  {
    issueIssue.prepare("SELECT sufficientInventoryToShipItem(:ordertype, :orderitemid, :orderqty) AS result;");
    issueIssue.bindValue(":ordertype",   _ordertype);
    issueIssue.bindValue(":orderitemid", _itemid);
    issueIssue.bindValue(":orderqty",  _qtyToIssue->toDouble());
    issueIssue.exec();
    if (issueIssue.first())
    {
      int result = issueIssue.value("result").toInt();
      if (result < 0)
      {
        ParameterList errp;
        if (_ordertype == "SO")
          errp.append("soitem_id", _itemid);
        else if (_ordertype == "TO")
          errp.append("toitem_id", _itemid);

        QString errs = "<? if exists(\"soitem_id\") ?>"
            "SELECT item_number, warehous_code "
            "  FROM coitem, item, itemsite, whsinfo "
            " WHERE ((coitem_itemsite_id=itemsite_id)"
            "   AND  (itemsite_item_id=item_id)"
            "   AND  (itemsite_warehous_id=warehous_id)"
            "   AND  (coitem_id=<? value(\"soitem_id\") ?>));"
            "<? elseif exists(\"toitem_id\")?>"
            "SELECT item_number, tohead_srcname AS warehous_code "
            "  FROM toitem, tohead, item "
            " WHERE ((toitem_item_id=item_id)"
            "   AND  (toitem_tohead_id=tohead_id)"
            "   AND  (toitem_id=<? value(\"toitem_id\") ?>));"
            "<? endif ?>" ;
        MetaSQLQuery errm(errs);
        issueIssue = errm.toQuery(errp);
        if (! issueIssue.first() && issueIssue.lastError().type() != QSqlError::NoError)
            systemError(this, issueIssue.lastError().databaseText(), __FILE__, __LINE__);
        systemError(this,
              storedProcErrorLookup("sufficientInventoryToShipItem",
                  result)
              .arg(issueIssue.value("item_number").toString())
              .arg(issueIssue.value("warehous_code").toString()), __FILE__, __LINE__);
        return;
      }
    }
    else if (issueIssue.lastError().type() != QSqlError::NoError)
    {
      systemError(this, issueIssue.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
  }

  // check to see if we are over issuing
  ParameterList params;
  if (_ordertype == "SO")
    params.append("soitem_id", _itemid);
  else if (_ordertype == "TO")
    params.append("toitem_id", _itemid);
  params.append("qty", _qtyToIssue->toDouble());

  QString sql = "<? if exists(\"soitem_id\") ?>"
                "SELECT  itemsite_costmethod,"
                "  (noNeg(coitem_qtyord - coitem_qtyshipped + coitem_qtyreturned) <"
                "           (COALESCE(SUM(shipitem_qty), 0) + <? value(\"qty\") ?>)) AS overship"
                "  FROM coitem LEFT OUTER JOIN"
                "        ( shipitem JOIN shiphead"
                "          ON ( (shipitem_shiphead_id=shiphead_id) AND (NOT shiphead_shipped) )"
                "        ) ON  (shipitem_orderitem_id=coitem_id)"
                "  JOIN itemsite ON (coitem_itemsite_id=itemsite_id) "
                " WHERE (coitem_id=<? value(\"soitem_id\") ?>)"
                " GROUP BY coitem_qtyord, coitem_qtyshipped, coitem_qtyreturned, "
                "   itemsite_costmethod, itemsite_controlmethod;"
                "<? elseif exists(\"toitem_id\") ?>"
                "SELECT false AS postprod,"
                "  (noNeg(toitem_qty_ordered - toitem_qty_shipped) <"
                "           (COALESCE(SUM(shipitem_qty), 0) + <? value(\"qty\") ?>)) AS overship"
                "  FROM toitem LEFT OUTER JOIN"
                "        ( shipitem JOIN shiphead"
                "          ON ( (shipitem_shiphead_id=shiphead_id) AND (NOT shiphead_shipped) )"
                "        ) ON  (shipitem_orderitem_id=toitem_id)"
                " WHERE (toitem_id=<? value(\"toitem_id\") ?>)"
                " GROUP BY toitem_qty_ordered, toitem_qty_shipped;"
                "<? endif ?>";
  MetaSQLQuery mql(sql);
  issueIssue = mql.toQuery(params);
  if (issueIssue.next() && issueIssue.value("overship").toBool())
  {
    if(XMessageBox::message( (isVisible() ? this : parentWidget()) , QMessageBox::Question, tr("Inventory Overshipped"),
        tr("<p>You have selected to ship more inventory than required. Do you want to continue?"),
        tr("Yes"), tr("No"), _snooze, 0, 1) == 1)
      return;
  }
  if (issueIssue.lastError().type() != QSqlError::NoError)
  {
    systemError(this, issueIssue.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  XSqlQuery rollback;
  rollback.prepare("ROLLBACK;");

  int invhistid = 0;
  int itemlocSeries = 0;

  XSqlQuery issue;
  issue.exec("BEGIN;");

  // If this is a lot/serial controlled job item, we need to post production first
  if (issueIssue.value("itemsite_costmethod").toString() == "J")
  {
    XSqlQuery prod;
    prod.prepare("SELECT postSoItemProduction(:soitem_id, :qty, :ts) AS result;");
    prod.bindValue(":soitem_id", _itemid);
    prod.bindValue(":qty", _qtyToIssue->toDouble());
    prod.bindValue(":ts", _transTS);
    prod.exec();
    if (prod.first())
    {
      itemlocSeries = prod.value("result").toInt();

      if (itemlocSeries < 0)
      {
        rollback.exec();
        systemError(this, storedProcErrorLookup("postProduction", itemlocSeries),
                    __FILE__, __LINE__);
        return;
      }
      else if (distributeInventory::SeriesAdjust(itemlocSeries, this) == XDialog::Rejected)
      {
        rollback.exec();
        QMessageBox::information( this, tr("Issue to Shipping"), tr("Issue Canceled") );
        return;
      }

      // Need to get the inventory history id so we can auto reverse the distribution when issuing
      prod.prepare("SELECT invhist_id "
                "FROM invhist "
                "WHERE ((invhist_series = :itemlocseries) "
                " AND (invhist_transtype = 'RM')); ");
      prod.bindValue(":itemlocseries" , itemlocSeries);
      prod.exec();
      if (prod.first())
        invhistid = prod.value("invhist_id").toInt();
      else
      {
        rollback.exec();
        systemError(this, tr("Inventory history not found"),
                    __FILE__, __LINE__);
        return;
      }
    }
  }

  issue.prepare("SELECT issueToShipping(:ordertype, :lineitem_id, :qty, :itemlocseries, :ts, :invhist_id) AS result;");
  issue.bindValue(":ordertype",   _ordertype);
  issue.bindValue(":lineitem_id", _itemid);
  issue.bindValue(":qty",         _qtyToIssue->toDouble());
  issue.bindValue(":ts",          _transTS);
  if (invhistid)
    issue.bindValue(":invhist_id", invhistid);
  issue.bindValue(":itemlocseries", itemlocSeries);
  issue.exec();

  if (issue.first())
  {
    int result = issue.value("result").toInt();
    if (result < 0)
    {
      rollback.exec();
      systemError( this, storedProcErrorLookup("issueToShipping", result),
		  __FILE__, __LINE__);
      return;
    }
    else
    {
      if (distributeInventory::SeriesAdjust(result, this) == XDialog::Rejected)
      {
        rollback.exec();
        QMessageBox::information( this, tr("Issue to Shipping"), tr("Issue Canceled") );
        return;
      }
	
	  // If Transfer Order then insert special pre-assign records for the lot/serial#
	  // so they are available when the Transfer Order is received
	  if (_ordertype == "TO")
	  {
        XSqlQuery lsdetail;
        lsdetail.prepare("INSERT INTO lsdetail "
	                     "            (lsdetail_itemsite_id, lsdetail_created, lsdetail_source_type, "
	  	  			     "             lsdetail_source_id, lsdetail_source_number, lsdetail_ls_id, lsdetail_qtytoassign, "
                                             "             lsdetail_expiration, lsdetail_warrpurc ) "
					     "SELECT invhist_itemsite_id, NOW(), 'TR', "
					     "       :orderitemid, invhist_ordnumber, invdetail_ls_id, (invdetail_qty * -1.0), "
                                             "       invdetail_expiration, invdetail_warrpurc "
					     "FROM invhist JOIN invdetail ON (invdetail_invhist_id=invhist_id) "
					     "WHERE (invhist_series=:itemlocseries);");
        lsdetail.bindValue(":orderitemid", _itemid);
        lsdetail.bindValue(":itemlocseries", result);
        lsdetail.exec();
        if (lsdetail.lastError().type() != QSqlError::NoError)
        {
          rollback.exec();
          systemError(this, lsdetail.lastError().databaseText(), __FILE__, __LINE__);
          return;
        }
	  }
	
      issue.exec("COMMIT;");
      accept();
    }
  }
  else if (issue.lastError().type() != QSqlError::NoError)
  {
    rollback.exec();
    systemError(this, issue.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
Ejemplo n.º 15
0
void ShadowManager::updateBlock(GameObject *block,
                                std::vector<cocos2d::V2F_C4B_T2F_Triangle> &triangles,
                                bool clipX) {
  auto renderer = block->getRenderer();
  if (!renderer->isShadowEnabled() || !renderer->isVisible() || !block->isRemovable()) {
    return;
  }
  if (renderer->getBoundingBox().containsPoint(mLightPos)) {
    return;
  }
  if (renderer->getShadowGroup() != mShadowGroup) {
    return;
  }

  auto bounds = GameLevel::instance().getBounds();
  auto camera = GameLevel::instance().getGameLayer()->getCamera();
#if EDITOR_MODE
  auto camRelative = camera->getPosition() - VisibleRect::getVisibleRect().size / 2 -
    Vec2(0, UI_LAYER_HIGHT / 2);
#else
  auto camRelative = camera->getPosition() - VisibleRect::getVisibleRect().size / 2;
#endif

  auto lightPos = mLightPos - camRelative;

  std::vector<Vec2> pts;
  block->getRenderer()->getPointsForShadow(lightPos, pts);
  for (auto &p : pts) {
    p -= camRelative;
  }
  auto entries = getShadowEntry(pts, lightPos);
  if (entries.noShadow) {
    return;
  }

  Color4B colorBase = Color4B::BLACK;
  const float LENGTH = 1500;

  Vec2 dir0, dir1;
  if (mLightType == LIGHT_POINT) {
    dir0 = entries.pt1 - lightPos;
    dir0.normalize();
    dir1 = entries.pt2 - lightPos;
    dir1.normalize();
  } else if (mLightType == LIGHT_DIR) {
    dir0 = dir1 = mLightDir;
  }

  Vec2 f0 = entries.pt1 + dir0 * LENGTH;
  Vec2 f1 = entries.pt2 + dir1 * LENGTH;

  if (clipX) {
    Vec2 leftupper(0, 2000);
    Vec2 leftlower(0, -1000);

    Vec2 rightupper(bounds.size.width, 2000);
    Vec2 rightlower(bounds.size.width, -1000);

    if (Vec2::isSegmentIntersect(leftlower, leftupper, entries.pt1, f0)) {
      f0 = Vec2::getIntersectPoint(leftlower, leftupper, entries.pt1, f0);
    }
    if (Vec2::isSegmentIntersect(leftlower, leftupper, entries.pt2, f1)) {
      f1 = Vec2::getIntersectPoint(leftlower, leftupper, entries.pt2, f1);
    }
    if (Vec2::isSegmentIntersect(rightlower, rightupper, entries.pt1, f0)) {
      f0 = Vec2::getIntersectPoint(rightlower, rightupper, entries.pt1, f0);
    }
    if (Vec2::isSegmentIntersect(rightlower, rightupper, entries.pt2, f1)) {
      f1 = Vec2::getIntersectPoint(rightlower, rightupper, entries.pt2, f1);
    }
  }

  Size visibleSize = VisibleRect::getVisibleRect().size;
  float center = visibleSize.width / 2;
  Vec2 offset(-center - visibleSize.width * (mPosX - 0.5f), 0);

  V2F_C4B_T2F_Triangle t;
  t.a.vertices = entries.pt1 + offset;
  t.a.colors = colorBase;

  t.b.vertices = f1 + offset;
  t.b.colors = colorBase;

  t.c.vertices = f0 + offset;
  t.c.colors = colorBase;

  triangles.push_back(t);

  t.a.vertices = entries.pt1 + offset;
  t.a.colors = colorBase;

  t.b.vertices = entries.pt2 + offset;
  t.b.colors = colorBase;

  t.c.vertices = f1 + offset;
  t.c.colors = colorBase;

  triangles.push_back(t);

  if (entries.needMakeUp) {
    t.a.vertices = entries.pt1 + offset;
    t.a.colors = colorBase;

    t.b.vertices = entries.pt2 + offset;
    t.b.colors = colorBase;

    t.c.vertices = entries.makeUpPt + offset;
    t.c.colors = colorBase;
    
    triangles.push_back(t);
  }
}
Ejemplo n.º 16
0
bool QQnxVirtualKeyboardBps::hideKeyboard()
{
    qVirtualKeyboardDebug() << "current visibility=" << isVisible();
    virtualkeyboard_hide();
    return true;
}
Ejemplo n.º 17
0
	virtual void setVisible(bool bVisible) override
	{
		if (bVisible && !isVisible())
			m_matrix.Invalidate();
		cocos2d::Sprite::setVisible(bVisible);
	}
Ejemplo n.º 18
0
void MainWindow::dockVisibilityChanged(bool visible) {
    if (isVisible())
        lyricsDockEnabled_ = visible;
}
Ejemplo n.º 19
0
bool Scene_Hell_Vale::ObjectClicked(const char *szObjectName, float x, float y)
{
   // Le joueur pioche dans les âmes
   if (strcmp(szObjectName, "hell_vale_hands_zone") == 0) {
      // Il y a déjà une âme
      if (isVisible("hell_vale_soul_1")
          || isVisible("hell_vale_soul_2")
          || isVisible("hell_vale_soul_3")
          ) {
         _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_ENOUGHSOUL"), "", true, false);
         return true;
      }
      else if (isVisible("hell_vale_soul_richard"))
      {
         _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_ENDSOUL"), "", true, false);
         return true;
      }
      // On pioche une âme
      else if (TaskResolved("task_hell_foundrichard")) {
         _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_ENDSOUL"), "", true, false);
      }
      else if (TaskResolved("task_hell_savesoul_3")) {
         RemoveHint("hell","escape","soul");
         ResolveTask("task_hell_meetsoul_richard");
         AddTask("task_hell_reassureseth");
         StartAnimation("soul4anim");
         StartAnimation("soul4rot");
         _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostcreep");
         _lpSceneDirector->getSequencer()->ShowImage(NULL, "hell_vale_soul_richard", true);
         SoulRequest(4);
      }
      else if (TaskResolved("task_hell_savesoul_2")) {
         ResolveTask("task_hell_meetsoul_3");
         AddTask("task_hell_savesoul_3");
         StartAnimation("soul3anim");
         StartAnimation("soul3rot");
         _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostcreep");
         _lpSceneDirector->getSequencer()->ShowImage(NULL, "hell_vale_soul_3", true);
         _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
         _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_NEWSOUL"), "", false, true);
         SoulRequest(3);
      }
      else if (TaskResolved("task_hell_savesoul_1")) {
         ResolveTask("task_hell_meetsoul_2");
         AddTask("task_hell_savesoul_2");
         StartAnimation("soul2anim");
         StartAnimation("soul3rot");
         _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostcreep");
         _lpSceneDirector->getSequencer()->ShowImage(NULL, "hell_vale_soul_2", true);
         _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
         _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_NEWSOUL"), "", false, true);
         SoulRequest(2);
      }
      else {
         ResolveTask("task_hell_meetsoul_1");
         AddTask("task_hell_savesoul_1");
         StartAnimation("soul1anim");
         StartAnimation("soul1rot");
         _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostcreep");
         _lpSceneDirector->getSequencer()->ShowImage(NULL, "hell_vale_soul_1", true);
         _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
         _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_NEWSOUL"), "", false, true);
         SoulRequest(1);
      }
   }
   
   // Clic sur une âme : rappel
   if (strcmp(szObjectName, "hell_vale_soul_1") == 0) {
      SoulRequest(1);
   }
   else if (strcmp(szObjectName, "hell_vale_soul_2") == 0) {
      SoulRequest(2);
   }
   else if (strcmp(szObjectName, "hell_vale_soul_3") == 0) {
      SoulRequest(3);
   }
   else if (strcmp(szObjectName, "hell_vale_soul_richard") == 0) {
      _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_ENDSOUL"), "", true, false);
   }
   
   // Objets à ramasser
   if (strcmp(szObjectName, "hell_item_heart") == 0)
   {
      PickupSimple(szObjectName, "inv_hell_item_heart");
      return true;
   }
   if (strcmp(szObjectName, "hell_item_eyeball") == 0)
   {
      _lpSceneDirector->getSequencer()->Talk(szObjectName, CHARACTER_POSX, CHARACTER_POSY, KStr("HELL_ASHLEY_EYEBALL"), "", true, false);
      return true;
   }
   if (strcmp(szObjectName, "hell_item_butterfly") == 0)
   {
      PickupSimple(szObjectName, "inv_hell_item_butterfly");
      return true;
   }
   if (strcmp(szObjectName, "hell_sling_stick") == 0)
   {
      PickupMultiple(szObjectName, "inv_hell_sling_stick",-1);
      return true;
   }
   if ( strncmp(szObjectName, "hell_item_cane[", strlen("hell_item_cane[")) == 0 )
   {
      PickupMultiple(szObjectName, "inv_hell_item_cane_part", 3);
   }
   
   return false;
}
Ejemplo n.º 20
0
void MainWindow::consoleVisibilityChanged(bool visible) {
    if (isVisible())
        consoleEnabled_ = visible;
}
Ejemplo n.º 21
0
void MainWindow::toggleVisibility()
{
	setVisible(!isVisible());
}
Ejemplo n.º 22
0
void MainWindow::slotShowOrHideWindow()
{
    setVisible(! isVisible());
}
Ejemplo n.º 23
0
QvisWindowBase::QvisWindowBase(const QString &captionString, Qt::WindowFlags f) :
    QMainWindow(parentOfEveryWindow, 
#if defined(Q_WS_WIN) || defined(Q_WS_MACX) || defined(Q_OS_WIN) || defined(Q_OS_MAC)
                Qt::Window | f)
{
    // Make each window the child of the first window that is created
    // when we run on the Windows platform. This prevents the sub-windows
    // from showing up in the taskbar.
    if(parentOfEveryWindow == 0)
        parentOfEveryWindow = this;
#else
                f)
{
#endif
    if(!captionString.isEmpty())
        setWindowTitle(captionString);
    else
        setWindowTitle("VisIt");

    saveWindowDefaults = false;
}

// ****************************************************************************
// Method: QvisWindowBase::~QvisWindowBase
//
// Purpose: 
//   Destructor for the QvisWindowBase class.
//
// Programmer: Brad Whitlock
// Creation:   Wed Aug 30 18:15:17 PST 2000
//
// Modifications:
//   
// ****************************************************************************

QvisWindowBase::~QvisWindowBase()
{
    // nothing here.
}

// ****************************************************************************
// Method: QvisWindowBase::showMinimized
//
// Purpose: 
//   Is the window is visible, this method minimizes the window.
//
// Programmer: Brad Whitlock
// Creation:   Thu Apr 19 10:36:40 PDT 2001
//
// Modifications:
//   
// ****************************************************************************

void
QvisWindowBase::showMinimized()
{
    if(isVisible())
        QMainWindow::showMinimized();
}

// ****************************************************************************
// Method: QvisWindowBase::showNormal
//
// Purpose: 
//   If the window is minimized, this method shows it normal (de-iconifies it)
//
// Programmer: Brad Whitlock
// Creation:   Thu Apr 19 10:37:14 PDT 2001
//
// Modifications:
//   
// ****************************************************************************

void
QvisWindowBase::showNormal()
{
    if(isMinimized())
        QMainWindow::showNormal();
}

// ****************************************************************************
// Method: QvisWindowBase::CreateNode
//
// Purpose: 
//   Adds the window's geometry and visibility status to the DataNode
//   tree that will be saved to the VisIt config file.
//
// Arguments:
//   parentNode : The parent node under which we'll add a node for
//                this window.
//
// Programmer: Brad Whitlock
// Creation:   Tue Oct 3 15:30:23 PST 2000
//
// Modifications:
//   Brad Whitlock, Fri Jun  6 10:29:33 PDT 2008
//   Qt 4.
//
// ****************************************************************************

void
QvisWindowBase::CreateNode(DataNode *parentNode)
{
    if(saveWindowDefaults)
    {
        DataNode *node = new DataNode(windowTitle().toStdString());
        parentNode->AddNode(node);

        // Add generic window attributes
        node->AddNode(new DataNode("x", x()));
        node->AddNode(new DataNode("y", y()));
        node->AddNode(new DataNode("width", width()));
        node->AddNode(new DataNode("height", height()));
        node->AddNode(new DataNode("visible", isVisible()));
    }
}

// ****************************************************************************
// Method: QvisWindowBase::SetFromNode
//
// Purpose: 
//   Sets the window's geometry information from the DataNode.
//
// Arguments:
//   parentNode : This a pointer to the "GUI" node.
//   borders : An array of 4 ints containing the sizes of the window
//             decorations.
//
// Programmer: Brad Whitlock
// Creation:   Tue Oct 3 15:41:34 PST 2000
//
// Modifications:
//   Brad Whitlock, Wed Sep 10 09:19:32 PDT 2003
//   Added a method to make sure that the window fits on the screen.
//
//   Hank Childs, Mon Nov 14 16:25:27 PST 2005
//   Don't allow windows to come up off the screen.
//
//   Brad Whitlock, Wed Nov 22 09:56:26 PDT 2006
//   Added code to override the window location if an anchor has been provided.
//
//   Brad Whitlock, Fri Jun  6 10:29:41 PDT 2008
//   Qt 4.
//
// ****************************************************************************

void
QvisWindowBase::SetFromNode(DataNode *parentNode, const int *borders)
{
    DataNode *winNode = parentNode->GetNode(windowTitle().toStdString());
    if(winNode == 0)
        return;

    // Indicate that the window should be saved.
    saveWindowDefaults = true;

    DataNode *node;
    bool xy_set = false, wh_set = false;
    int x = 0, y = 0;
    int w = width();
    int h = height();

    // See if any attributes are set.
    if((node = winNode->GetNode("x")) != 0)
    {
        int x_pos = node->AsInt();
        if (x_pos < 0)
            x_pos = 0;
        x = x_pos + borders[2];
        xy_set = true;
    }
    if((node = winNode->GetNode("y")) != 0)
    {
        int y_pos = node->AsInt();
        if (y_pos < 0)
            y_pos = 0;
        y = y_pos + borders[0];
        xy_set = true;
    }
    if((node = winNode->GetNode("width")) != 0)
    {
        w = node->AsInt();
        wh_set = true;
    }
    if((node = winNode->GetNode("height")) != 0)
    {
        h = node->AsInt();
        wh_set = true;
    }

    // Possibly override the window anchor location.
    xy_set |= GetWindowAnchorLocation(x, y);

    // Make sure that the window will fit on the screen.
    FitToScreen(x, y, w, h);

    // Set the window geometry.
    if(wh_set && xy_set)
        setGeometry(x, y, w, h);
    else if(xy_set)
        move(x, y);
    else if(wh_set)
        resize(w, h);

    // If the window is visible, show it.
    if((node = winNode->GetNode("visible")) != 0)
    {
        if(node->AsBool())
            show();
    }
}
Ejemplo n.º 24
0
void EnvelopeEditorControl::paint(PPGraphicsAbstract* g)
{
	if (!isVisible())
		return;
	
	pp_int32 xOffset = 2;

	pp_int32 yOffset = 2;

	g->setRect(location.x, location.y, location.x + size.width, location.y + size.height);

	g->setColor(backgroundColor);

	g->fill();

	if (border)
	{
		drawBorder(g, *borderColor);
	}

	g->setRect(location.x+1, location.y+1, location.x+1 + size.width-2, location.y+1 + size.height-2);

	g->setColor(255, 255, 255);

	if (envelope == NULL)
	{
		PPFont* font = PPFont::getFont(PPFont::FONT_SYSTEM);
		g->setFont(font);
		PPString s("None selected");

		g->drawString(s, location.x + size.width / 2 - font->getStrWidth(s) / 2, location.y + size.height / 2 - font->getCharHeight() / 2); 

		return;
	}

	float scaley = calcYScale();
	float scalex = calcXScale();

	pp_int32 i;

	paintGrid(g, xOffset, yOffset);

	g->setColor(255, 255, 255);
	// vertical
	for (i = 0; i <= yMax; i++)
	{	
		if (!(i & 15))
		{
			pp_int32 y1 = (pp_int32)(i*scaley);
			y1 = location.y + yOffset + visibleHeight - y1;

			g->setPixel(location.x + xOffset, y1);
			if (!(i&31))
			{
				g->setPixel(location.x + xOffset-1, y1);
			}
		}
	}
	
	/*// horizontal
	for (i = 0; i <= visibleWidth; i++)
	{
		pp_int32 i2 = i + startPos;
	
		pp_int32 x1 = i;
		pp_int32 x = x1 + location.x + xOffset;

		pp_int32 y1 = location.y + yOffset + visibleHeight - (pp_int32)(128*scaley);

		if (!(i2 & 3))
		{		
			g->setPixel(x, location.y + yOffset + visibleHeight);
		
			if (!(i2&31))
			{
				g->setPixel(x, location.y + yOffset + visibleHeight + 1);
			}
		
		}
	}*/

	// centered line
	for (i = 0; i <= visibleWidth; i++)
	{
		pp_int32 x1 = i;
		pp_int32 x = x1 + location.x + xOffset;

		pp_int32 y1 = location.y + yOffset + visibleHeight - (pp_int32)(128*scaley);

		if (showVCenter)
		{
			if (!(i&7))
				g->setColor(128, 128, 128);
			else
				g->setColor(64, 64, 64);
		
			g->setPixel(x, y1);
		}
	}

	g->setColor(255, 255, 128);
	if (!envelope->num)
	{
		PPFont* font = PPFont::getFont(PPFont::FONT_SYSTEM);
		g->setFont(font);
		PPString s("No envelope");

		g->drawString(s, location.x + size.width / 2 - font->getStrWidth(s) / 2, location.y + size.height / 2 - font->getCharHeight()); 
	}

	for (i = 0; i < envelope->num - 1; i++)
	{
		
		pp_int32 x1 = (pp_int32)(envelope->env[i][0]*scalex);
		pp_int32 y1 = (pp_int32)(envelope->env[i][1]*scaley);
		
		pp_int32 x2 = (pp_int32)(envelope->env[i+1][0]*scalex);
		pp_int32 y2 = (pp_int32)(envelope->env[i+1][1]*scaley);

		x1+=location.x + xOffset - startPos;
		x2+=location.x + xOffset - startPos;

		y1 = location.y + yOffset + visibleHeight - y1;
		y2 = location.y + yOffset + visibleHeight - y2;

		g->drawAntialiasedLine(x1,y1,x2,y2);
		//g->drawLine(x1,y1,x2,y2);

		//g->setPixel(location.x + xOffset + x, location.y + yOffset + size.height - 4 - y);

	}

	// Showmarks
	g->setColor(255, 0, 255);
	
	for (pp_int32 sm = 0; sm < TrackerConfig::maximumPlayerChannels; sm++)
	{
		pp_int32 showMark = showMarks[sm].pos;
		if (!showMarks[sm].intensity || showMark == -1)
			continue;

		pp_int32 x = (pp_int32)(showMark*scalex) - startPos;
		g->drawVLine(location.y + yOffset, location.y + yOffset + visibleHeight + 2, location.x + xOffset + x); 
	}
	
	for (i = 0; i < envelope->num; i++)
	{
		pp_int32 x1 = (pp_int32)(envelope->env[i][0]*scalex);
		pp_int32 y1 = (pp_int32)(envelope->env[i][1]*scaley);

		x1+=location.x + xOffset - startPos;
		y1 = location.y + yOffset + visibleHeight - y1;

		if ((envelope->type & 4) && (i == envelope->loops || i == envelope->loope))
		{
			g->setColor(TrackerConfig::colorHighLight_1);

			for (pp_int32 j = 0; j < visibleHeight; j+=2)
				g->setPixel(x1, j + location.y + yOffset);		
		
			if (i == envelope->loops)
			{
				g->setPixel(x1, location.y + yOffset);

				g->setPixel(x1, location.y + yOffset + 1);
				g->setPixel(x1+1, location.y + yOffset + 1);
				g->setPixel(x1-1, location.y + yOffset + 1);
				
				g->setPixel(x1, location.y + yOffset + 2);
				g->setPixel(x1+1, location.y + yOffset + 2);
				g->setPixel(x1-1, location.y + yOffset + 2);
				g->setPixel(x1+2, location.y + yOffset + 2);
				g->setPixel(x1-2, location.y + yOffset + 2);
			}
			if (i == envelope->loope)
			{
				g->setPixel(x1, location.y + visibleHeight + yOffset);

				g->setPixel(x1, location.y + visibleHeight + yOffset - 1);
				g->setPixel(x1+1, location.y + visibleHeight + yOffset - 1);
				g->setPixel(x1-1, location.y + visibleHeight + yOffset - 1);
				
				g->setPixel(x1, location.y + visibleHeight + yOffset - 2);
				g->setPixel(x1+1, location.y + visibleHeight + yOffset - 2);
				g->setPixel(x1-1, location.y + visibleHeight + yOffset - 2);
				g->setPixel(x1+2, location.y + visibleHeight + yOffset - 2);
				g->setPixel(x1-2, location.y + visibleHeight + yOffset - 2);
			}
		
		}
		if ((envelope->type & 2) && (i == envelope->sustain))
		{
			g->setColor(255, 255, 255);

			for (pp_int32 j = 0; j < visibleHeight; j+=2)
				g->setPixel(x1, j + location.y + yOffset + 1);		
		}

		/*pp_int32 extent = 1;

		if (i == selectionIndex)
		{
			g->setColor(255, 0, 0);
			extent = 2;
		}
		else*/
		
		if (i != envelopeEditor->getSelectionIndex())
		{
			const pp_int32 extent = 1;
			
			g->setColor(255, 255, 255);
			
			for (pp_int32 y = -extent; y <= extent; y++)
				for (pp_int32 x = -extent; x <= extent; x++)
					g->setPixel(x1+x, y1+y);
		}
		
	}
	
	// draw selected point always above the other points
	if (envelopeEditor->getSelectionIndex() != -1)
	{
		i = envelopeEditor->getSelectionIndex();
		pp_int32 x1 = (pp_int32)(envelope->env[i][0]*scalex);
		pp_int32 y1 = (pp_int32)(envelope->env[i][1]*scaley);

		x1+=location.x + xOffset - startPos;
		y1 = location.y + yOffset + visibleHeight - y1;

		const pp_int32 extent = 2;
			
		g->setColor(255, 0, 0);
			
		for (pp_int32 y = -extent; y <= extent; y++)
			for (pp_int32 x = -extent; x <= extent; x++)
				g->setPixel(x1+x, y1+y);
	}

	if (currentPosition.x >= 0 && currentPosition.y >= 0)
	{
		PPFont* font = PPFont::getFont(PPFont::FONT_TINY);
		g->setFont(font);

		// loop markers above range text
		char buffer[32];
		PPTools::convertToHex(buffer, (unsigned)currentPosition.x, 4);

		g->setColor(0, 0, 0);
		g->drawString(buffer, location.x + 3 + visibleWidth - font->getStrWidth(buffer), location.y + 4);
		g->setColor(255, 0, 255);
		g->drawString(buffer, location.x + 2 + visibleWidth - font->getStrWidth(buffer), location.y + 3);

		PPTools::convertToHex(buffer, (unsigned)currentPosition.y, 2);

		g->setColor(0, 0, 0);
		g->drawString(buffer, location.x + 3 + visibleWidth - font->getStrWidth(buffer), location.y + 4 + font->getCharHeight()+2);
		g->setColor(0, 255, 0);
		g->drawString(buffer, location.x + 2 + visibleWidth - font->getStrWidth(buffer), location.y + 3 + font->getCharHeight()+2);
	}

	hScrollbar->paint(g);

}
Ejemplo n.º 25
0
void ccDrawableObject::toggleVisibility()
{
	setVisible(!isVisible());
}
void QNMouseProfileWidget::TPDP_OnRSP(T3K_DEVICE_INFO /*devInfo*/, ResponsePart /*Part*/, unsigned short /*ticktime*/, const char */*partid*/, int /*id*/, bool /*bFinal*/, const char *cmd)
{
    if( !m_bCheckMacOSXZoom && !isVisible() ) return;

    if( strstr(cmd, cstrUsbConfigMode) == cmd )
    {
        m_RequestCmdManager.RemoveItem( cstrUsbConfigMode );
        m_nChkUsbCfgMode = -1;

        int nMode = strtol(cmd + sizeof(cstrUsbConfigMode) - 1, NULL, 16);
        switch( nMode )
        {
        case 0x04: // digitizer
            ui->TabMouseSettingTable->setEnabled( false );
            break;
        case 0x07: // full
            ui->TabMouseSettingTable->setEnabled( true );
            break;
        default:
            break;
        }
    }
    else if( strstr(cmd, cstrInputMode) == cmd )
    {
        m_RequestCmdManager.RemoveItem( cstrInputMode );

        char* pInputMode = NULL;
        pInputMode = (char*)strchr( cmd, ',' );

        int nMode1 = -1;

        if( !pInputMode )
            m_nInputMode = strtol(cmd + sizeof(cstrInputMode) - 1, NULL, 16);
        else
        {
            nMode1 = strtol(cmd + sizeof(cstrInputMode) - 1, NULL, 16);
            if( nMode1 == 0xFF )
                m_nInputMode = strtol( pInputMode+1, NULL, 16 );
            else
                m_nInputMode = nMode1;
        }

        emit SendInputModeState();
    }
    else if ( strstr(cmd, cstrMouseProfile) == cmd )
    {
        m_RequestCmdManager.RemoveItem( cstrMouseProfile );

        int nProfile = atoi(cmd + sizeof(cstrMouseProfile) - 1 );
        char* pProfile = (char*)strchr( cmd, ',' );
        if( pProfile )
        {
            int nMouseIdx = strtol( cmd + sizeof(cstrMouseProfile) - 1, NULL, 10 );
            int nMultiIdx = strtol( pProfile+1, NULL, 10 );

            switch( m_nInputMode )
            {
            case 0xFF:
            case -1:
                Q_ASSERT(false);
                break;
            case 0x02:
                nProfile = nMultiIdx;
                break;
            case 0x00:
            default:
                nProfile = nMouseIdx;
                break;
            }

            ui->TabMouseSettingTable->selectTab( nProfile-1 );
            if( m_bDefault )
            {
                loadPredefProfiles( nProfile-1 );
                onModifiedProfile();
                m_bDefault = false;
            }
        }
    }

    if ( strstr(cmd, cstrMouseProfile1) == cmd )
    {
        m_RequestCmdManager.RemoveItem( cstrMouseProfile1 );
        m_bCheckMacOSXZoom = false;
    }

    if ( strstr(cmd, cstrMouseProfile2) == cmd )
    {
        m_RequestCmdManager.RemoveItem( cstrMouseProfile2 );
        m_bCheckMacOSXZoom = false;
    }
}
Ejemplo n.º 27
0
/** Overridden so that not touchable unless specifically set as such. */
bool CC3WireframeBoundingBoxNode::isTouchable()
{
	return (isVisible() || m_shouldAllowTouchableWhenInvisible) && isTouchEnabled();
}
Ejemplo n.º 28
0
//=============================================================
//=============================================================
bool CCScrollLayer::onTouchBegan(Touch *pTouch, Event *pEvent)
{
    if (!isVisible()) // 父视图改变visible 不影响孩子的变量   //不可见依然接收touch
    { 
        return false;
    }
    
    Node* fatherNode = getParent();
    if(!fatherNode)
        return false;
    
    Point touchPointInWorld = pTouch->getLocation();
    
    Rect  selfRect = boundingBox();
    Point selfOriginInWorld = fatherNode->convertToWorldSpace(selfRect.origin);
    
    Rect selfRectInWorld = Rect(selfOriginInWorld.x,selfOriginInWorld.y,selfRect.size.width,selfRect.size.height);
    if(selfRectInWorld.containsPoint(touchPointInWorld) == false)
    {
        return false;
    }
    
    for (Node *c = this->_parent; c != NULL; c = c->getParent()) 
    {
        if (c->isVisible() == false) //若父亲有不可见的则不处理touch
        {
            return false;
        }
        
        Rect  rect = c->boundingBox();
        Node* parentNode = c->getParent();
        if(parentNode)
        {
            Point originInWorld = parentNode->convertToWorldSpace(rect.origin);
            
            Rect rectInWorld = Rect(originInWorld.x,originInWorld.y,rect.size.width,rect.size.height);
            if(rectInWorld.containsPoint(touchPointInWorld) == false)
            {
                return false;
            }
        }
        
    }
    
   // CCSetIterator it = pTouches->begin();
    Touch* touch = pTouch;
	m_beginPoint = touch->getLocation();
    
    Node* parent = getParent();
    Point localPoint = parent->convertToNodeSpace(m_beginPoint);
    Rect boundRect = boundingBox();
    
    bool unmoveAbleFlag = getContentSize().equals(m_contentLayer->getContentSize());// CCSize::CCSizeEqualToSize(getContentSize(),m_contentLayer->getContentSize());
    if(boundRect.containsPoint(localPoint) && unmoveAbleFlag==false) //点击开始在区域内
    {
        m_containBeginTouchPointFlag = true;
        m_2fLastMoveDis = vertex2(0, 0);
        
        sendSelector(SSTE_TOUCH_BEGIN);
       
        if(m_decelerateFlag)
        {
            m_decelerateFlag = false;
            unschedule(schedule_selector(CCScrollLayer::decelerateTick));
            
        }
        moveToEndPosition(false,m_contentLayer->getPosition());
        return true;
    }
    else
    {
        m_containBeginTouchPointFlag = false;
        return false;
    }
}
Ejemplo n.º 29
0
void MainWindow::networkError(const QString &error_msg) {
    if (isVisible())
        QMessageBox::warning(this, tr("Network error"), error_msg);
}
Ejemplo n.º 30
0
void PD_UI_Tasklist::update(Step * _step){
	if(isVisible()){
		NodeUI::update(_step);
	}
}