Esempio n. 1
0
TEST_F( Labels, Files )
{
    auto f = ml->addMedia( "media.avi" );
    auto f2 = ml->addMedia( "file.mp3" );
    auto f3 = ml->addMedia( "otter.mkv" );

    auto l1 = ml->createLabel( "label1" );
    auto l2 = ml->createLabel( "label2" );

    f->addLabel( l1 );
    f2->addLabel( l2 );
    f3->addLabel( l1 );

    auto label1Files = l1->media()->all();
    auto label2Files = l2->media()->all();

    ASSERT_EQ( label1Files.size(), 2u );
    ASSERT_EQ( label2Files.size(), 1u );

    ASSERT_EQ( label2Files[0]->id(), f2->id() );

    for (auto labelFile : label1Files )
    {
        ASSERT_TRUE( labelFile->id() == f->id() ||
                     labelFile->id() == f3->id() );
    }
}
Esempio n. 2
0
OptionsWidget_userListBackground::OptionsWidget_userListBackground(QWidget * parent)
    : KviOptionsWidget(parent, "userlistlook_background_options_widget")
{
	createLayout();

	KviTalGroupBox * g = addGroupBox(0, 0, 1, 0, Qt::Horizontal, __tr2qs_ctx("Background Colors", "options"));
	addColorSelector(g, __tr2qs_ctx("Normal:", "options"), KviOption_colorUserListViewBackground);
	addColorSelector(g, __tr2qs_ctx("Selected:", "options"), KviOption_colorUserListViewSelectionBackground);

	addPixmapSelector(0, 1, 1, 1, __tr2qs_ctx("Background image:", "options"), KviOption_pixmapUserListViewBackground);

	addLabel(0, 2, 0, 2, __tr2qs_ctx("Horizontal alignment:", "options"));
	m_pHorizontalAlign = new QComboBox(this);
	addWidgetToLayout(m_pHorizontalAlign, 1, 2, 1, 2);

	addLabel(0, 3, 0, 3, __tr2qs_ctx("Vertical alignment:", "options"));
	m_pVerticalAlign = new QComboBox(this);
	addWidgetToLayout(m_pVerticalAlign, 1, 3, 1, 3);

	m_pHorizontalAlign->addItem(__tr2qs_ctx("Tile", "options"));
	m_pHorizontalAlign->addItem(__tr2qs_ctx("Left", "options"));
	m_pHorizontalAlign->addItem(__tr2qs_ctx("Right", "options"));
	m_pHorizontalAlign->addItem(__tr2qs_ctx("Center", "options"));

	m_pVerticalAlign->addItem(__tr2qs_ctx("Tile", "options"));
	m_pVerticalAlign->addItem(__tr2qs_ctx("Top", "options"));
	m_pVerticalAlign->addItem(__tr2qs_ctx("Bottom", "options"));
	m_pVerticalAlign->addItem(__tr2qs_ctx("Center", "options"));

	switch(KVI_OPTION_UINT(KviOption_uintUserListPixmapAlign) & Qt::AlignHorizontal_Mask)
	{
		case Qt::AlignLeft:
			m_pHorizontalAlign->setCurrentIndex(1);
			break;
		case Qt::AlignRight:
			m_pHorizontalAlign->setCurrentIndex(2);
			break;
		case Qt::AlignHCenter:
			m_pHorizontalAlign->setCurrentIndex(3);
			break;
		default:
			m_pHorizontalAlign->setCurrentIndex(0);
	}

	switch(KVI_OPTION_UINT(KviOption_uintUserListPixmapAlign) & Qt::AlignVertical_Mask)
	{
		case Qt::AlignTop:
			m_pVerticalAlign->setCurrentIndex(1);
			break;
		case Qt::AlignBottom:
			m_pVerticalAlign->setCurrentIndex(2);
			break;
		case Qt::AlignVCenter:
			m_pVerticalAlign->setCurrentIndex(3);
			break;
		default:
			m_pVerticalAlign->setCurrentIndex(0);
	}
	layout()->setRowStretch(1, 1);
}
void InterfaceView::initButtons()
{
    OptionsTemplateView::initButtons();

    int xTextStart       = bodyTextRect.min.x;
    int x                = xTextStart;
    int y                = bodyTextRect.min.y;
    int yOffset          =  15;

    int arrowButtonWidth =  16;

    // Settings
    //----------------------------------------------------------------------

    x = xTextStart;
    addLabel(iXY(x, y), "OPTION                                               SETTING", viewHeadingColor);
    y += yOffset;

    x = xTextStart;
    addLabel(iXY(x, y), "Scroll Rate", Color::white);
    x = optionsMeterStartX;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseScrollRate);
    x += optionsMeterWidth + arrowButtonWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseScrollRate);
    y += yOffset;
}
Esempio n. 4
0
bool TextStyleBuilder::addFeatureCommon(const Feature& _feat, const DrawRule& _rule, bool _iconText) {
    TextStyle::Parameters params = applyRule(_rule, _feat.props, _iconText);

    Label::Type labelType;
    if (_feat.geometryType == GeometryType::lines) {
        labelType = Label::Type::line;
        params.wordWrap = false;
    } else {
        labelType = Label::Type::point;
    }

    // Keep start position of new quads
    size_t quadsStart = m_quads.size();
    size_t numLabels = m_labels.size();

    if (!prepareLabel(params, labelType)) { return false; }

    if (_feat.geometryType == GeometryType::points) {
        for (auto& point : _feat.points) {
            auto p = glm::vec2(point);
            addLabel(params, Label::Type::point, { p, p });
        }

    } else if (_feat.geometryType == GeometryType::polygons) {
        for (auto& polygon : _feat.polygons) {
            if (_iconText) {
                auto p = centroid(polygon);
                addLabel(params, Label::Type::point, { p, p });
            } else {
                for (auto& line : polygon) {
                    for (auto& point : line) {
                        auto p = glm::vec2(point);
                        addLabel(params, Label::Type::point, { p });
                    }
                }
            }
        }

    } else if (_feat.geometryType == GeometryType::lines) {

        if (_iconText) {
            for (auto& line : _feat.lines) {
                for (auto& point : line) {
                    auto p = glm::vec2(point);
                    addLabel(params, Label::Type::point, { p });
                }
            }
        } else {
            addLineTextLabels(_feat, params);
        }
    }

    if (numLabels == m_labels.size()) {
        // Drop quads when no label was added
        m_quads.resize(quadsStart);
    }
    return true;
}
Esempio n. 5
0
void KileWidget::StatusBar::reset()
{
	addLabel(HintText, i18n("Normal Mode"), 10);
	addPermanentWidget(m_errorHandler->compilationResultLabel());
	addLabel(ParserStatus, QString(), 0);
	addLabel(LineColumn, QString(), 0);
	addLabel(ViewMode, QString(), 0);
	addLabel(SelectionMode, QString(), 0);
}
Esempio n. 6
0
void TextStyleBuilder::addLineTextLabels(const Feature& _feat, const TextStyle::Parameters& _params) {
    float pixelScale = 1.0/m_tileSize;
    float minLength = m_attributes.width * pixelScale;

    float tolerance = pow(pixelScale * 2, 2);

    for (auto& line : _feat.lines) {

        for (size_t i = 0; i < line.size() - 1; i++) {
            glm::vec2 p1 = glm::vec2(line[i]);
            glm::vec2 p2;

            float segmentLength = 0;
            bool merged = false;
            size_t next = i+1;

            for (size_t j = next; j < line.size(); j++) {
                glm::vec2 p = glm::vec2(line[j]);
                segmentLength = glm::length(p1 - p);

                if (j == next) {
                    if (segmentLength > minLength) {
                        addLabel(_params, Label::Type::line, { p1, p });
                    }
                } else {
                    glm::vec2 pp = glm::vec2(line[j-1]);

                    float d = sqPointSegmentDistance(pp, p1, p);
                    if (d > tolerance) { break; }

                    // Skip merged segment
                    merged = true;
                    i += 1;
                }
                p2 = p;
            }

            // place labels at segment-subdivisions
            int run = merged ? 1 : 2;
            segmentLength /= run;

            while (segmentLength > minLength && run <= 4) {
                glm::vec2 a = p1;
                glm::vec2 b = glm::vec2(p2 - p1) / float(run);

                for (int r = 0; r < run; r++) {
                    addLabel(_params, Label::Type::line, { a, a+b });
                    a += b;
                }
                run *= 2;
                segmentLength /= 2.0f;
            }

        }
    }
}
void PMUICanvasRibbonRenderer::init(int posX, int posY, bool autosize, int width, int height)
{
    PMUICanvasBaseRenderer::init(posX, posY, autosize, width, height);

    gradientImage.load("./gradients/gradient4x_512x160.png");
    numGradients = 4;

    setGlobalSliderHeight(10);
    setGlobalButtonDimension(14);

    { // Brush (basic)
        addSpacer();
        addLabel(STR_BRUSH_BASIC);
        addIntSlider(STR_BRUSH_BASIC_NUMPAINTERS, 1, 100, &numPainters);
        addIntSlider(STR_BRUSH_BASIC_WIDTH, 1, 10, &strokeWidth);
        addSlider(STR_BRUSH_BASIC_SPEED, 1.01f, 100, &speed);
        addToggle(STR_BRUSH_BASIC_ENABLEBOUNCE, &enableBounce);
    }

    { // Brush (advanced)
        addSpacer();
        addLabel(STR_BRUSH_ADVANCED);
        addSlider(STR_BRUSH_ADVANCED_DIVISIONS, 0.001, 4.5, &divisions);
//        addSlider(STR_BRUSH_ADVANCED_EASE, -1.0, 10.0, &ease);
//        addSlider("Ease Randomness",0.0,1.0,&easeRandomness);
//        addIntSlider(STR_BRUSH_ADVANCED_MAXVERT,3, 4000, &pathMaxVertices);
        addSlider("Next Position Delta",0.0,1.0,&nextPositionDelta);
    }

    { // Color mode
        addSpacer();
        addLabel(STR_BRUSH_COLORMODE);

        vector<string> colorModesNames;
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MFIXEDCOLOR);
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MGRSPEED);
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MGREDGES);
        addRadio(STR_BRUSH_COLORMODE_RADIO, colorModesNames, OFX_UI_ORIENTATION_VERTICAL);

        addImageSampler(STR_BRUSH_COLORMODE_GRIMAGE, &gradientImage);
        addIntSlider(STR_BRUSH_COLORMODE_GRID, 1, 4, &gradientId);
        addIntSlider(STR_BRUSH_COLORMODE_GRSPEED, 1, 500, &gradientSpeed);
        addIntSlider(STR_BRUSH_COLORMODE_R, 0, 255, &colorR);
        addIntSlider(STR_BRUSH_COLORMODE_G, 0, 255, &colorG);
        addIntSlider(STR_BRUSH_COLORMODE_B, 0, 255, &colorB);
    }

    if (autosize) autoSizeToFitWidgets();

    loadPreset(selectedPreset);
}
InterfaceComponent::InterfaceComponent()
{
    btnGenerate.setButtonText ("Generate");
    btnGenerate.setTooltip ("Generates a module at a specified folder");
    btnGenerate.addListener (this);
    btnGenerate.setColour (juce::TextButton::buttonColourId, juce::Colour (0xff3dc40d));
    btnGenerate.setColour (juce::TextButton::buttonOnColourId, juce::Colour (0xff007a06));

    btnBrowse.setButtonText ("Browse folder...");
    btnBrowse.setConnectedEdges (juce::Button::ConnectedOnRight);
    btnBrowse.setColour (juce::TextButton::buttonColourId, juce::Colour (0xffbababa));
    btnBrowse.setColour (juce::TextButton::buttonOnColourId, juce::Colour (0xff909090));
    btnBrowse.addListener (this);

    btnRefresh.setButtonText ("Refresh");
    btnRefresh.setConnectedEdges (juce::Button::ConnectedOnLeft);
    btnRefresh.setColour (juce::TextButton::buttonColourId, juce::Colour (0xffbababa));
    btnRefresh.setColour (juce::TextButton::buttonOnColourId, juce::Colour (0xff909090));
    btnRefresh.addListener (this);

    fileListBox.setColour (juce::ListBox::outlineColourId, juce::Colours::white.withAlpha (0.5f));
    fileListBox.setColour (juce::ListBox::textColourId, juce::Colours::white);
    fileListBox.setColour (juce::ListBox::backgroundColourId, juce::Colours::darkgrey.brighter().withAlpha (0.5f));
    fileListBox.setMultipleSelectionEnabled (true);
    fileListBox.setModel (this);

    grpClassConfiguration.setColour (juce::GroupComponent::ColourIds::textColourId, juce::Colours::white);
    grpClassConfiguration.setText ("Module Class Configuration");

    addLabel (lblFileName, "Module Name:", "Will be the name for header and CPP files");
    addLabel (lblHeaderGuard, "Header Guard:", "Will be the header file\'s include guard.");
    addLabel (lblNamespace, "Namespace:", "Optional. Will wrap the headers and source files with the namespace name.");
    addLabel (lblDestinationFolder, "Destination Folder:", "Folder that will contain the newly created module file for the listed files.");

    addTextEditor (txtSourceFileFolder, juce::String::empty, true);
    addTextEditor (txtModuleFilename, "MyModule");
    addTextEditor (txtHeaderGuard, "MYMODULE_H");
    addTextEditor (txtNamespace);
    addTextEditor (txtDestinationFolder);

    addAndMakeVisible (&fileListBox);
    addAndMakeVisible (&grpClassConfiguration);
    addAndMakeVisible (&btnRefresh);
    addAndMakeVisible (&btnGenerate);
    addAndMakeVisible (&btnBrowse);

    setSize (800, 600);
    startTimer (timerIntervalMS);
}
Esempio n. 9
0
void VCFrame::slotMenuCallback(int item)
{
	switch (item)
	{
	case KVCMenuAddButton:
		addButton();
		break;
	case KVCMenuAddSlider:
		addSlider();
		break;
	case KVCMenuAddFrame:
		addFrame();
		break;
	case KVCMenuAddXYPad:
		addXYPad();
		break;
	case KVCMenuAddLabel:
		addLabel();
		break;

	default:
		VCWidget::slotMenuCallback(item);
		break;
	}
}
Esempio n. 10
0
void CreateAbsoluteLabel( orl_sec_handle shnd, orl_sec_offset loc, unnamed_label_return return_struct )
{
    label_list          sec_label_list;
    hash_data *         data_ptr;
    label_entry         entry;

    entry = MemAlloc( sizeof( label_entry_struct ) );
    if( !entry ) {
        return_struct->error = RC_OUT_OF_MEMORY;
        return;
    }
    entry->offset = loc;
    entry->type = LTYP_ABSOLUTE;
    entry->label.number = 0;
    entry->shnd = shnd;
    data_ptr = HashTableQuery( HandleToLabelListTable, (hash_value) shnd );
    if( data_ptr ) {
        sec_label_list = (label_list) *data_ptr;
        entry = addLabel( sec_label_list, entry, 0 );
        return_struct->entry = entry;
        return_struct->error = RC_OKAY;
    } else {
        // error!!!! the label list should have been created
        return_struct->error = RC_ERROR;
    }
    return;
}
Esempio n. 11
0
void NodeRenderer::label(const Cairo::RefPtr<Cairo::Context>& cr,
		std::list<shared_ptr<Label> >& labels,
		AssetCache& cache)
{
	// nothing to print
	if (s->text.str().size() == 0 || s->font_size <= 0)
		return;

	cr->save();

	cr->set_font_size(s->font_size);

	cr->set_font_face(cache.getFont(
			s->font_family.str(),
			s->font_style == Style::STYLE_ITALIC ? Cairo::FONT_SLANT_ITALIC : Cairo::FONT_SLANT_NORMAL,
			s->font_weight == Style::WEIGHT_BOLD ? Cairo::FONT_WEIGHT_BOLD : Cairo::FONT_WEIGHT_NORMAL
		));

	Cairo::TextExtents textSize;
	cr->get_text_extents(s->text.str(), textSize);

	addLabel(labels, location + FloatPoint(0.0, s->text_offset), textSize);

	cr->restore();
}
Esempio n. 12
0
// Description:  Constructor.
//
KxCheckBoxGrp::KxCheckBoxGrp(
                                   QWidget *parent, bool hasLabel, int nChecks)
                                   : KxWidgetGrp(parent)
{
    if (hasLabel)
    {
        // Add a label.
        //
        addLabel();
    }

    // Add the check boxes.
    //
    for (int i = 0; i < nChecks; i++)
    {
        QString text;
        KxCheckBox * checkBox = new KxCheckBox(text);
        if (checkBox != NULL)
        {
            QString name;
            QTextStream(&name) << kCheckBoxBaseName << i+1;
            checkBox->setObjectName(name);
            addField(checkBox);
        }  
    }
}
OptionsWidget_urlHandlers::OptionsWidget_urlHandlers(QWidget * parent)
: KviOptionsWidget(parent)
{
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
	#define START_ROW 2
#else
	#define START_ROW 1
#endif

	setObjectName("urlhandlers_options_widget");
	createLayout();

	KviTalGroupBox * gbox = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("Mouse handler","options"));

	addLabel(gbox,__tr2qs_ctx("How many click to open links?","options"));

	m_pClickRadio = new QRadioButton(__tr2qs_ctx("Single click","options"),gbox);
	m_pDoubleClickRadio = new QRadioButton(__tr2qs_ctx("Double click","options"),gbox);

	switch(KVI_OPTION_UINT(KviOption_uintUrlMouseClickNum))
	{
		case 1:
			m_pClickRadio->setChecked(true);
			break;
		case 2:
			m_pDoubleClickRadio->setChecked(true);
			break;
	}

	gbox = addGroupBox(0,1,0,1,Qt::Horizontal,__tr2qs_ctx("Protocol handler","options"));

#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
	KviBoolSelector *b = addBoolSelector(gbox,__tr2qs_ctx("Use system URL handlers","options"),KviOption_boolUseSystemUrlHandlers);
#endif

	m_pHttpHandler=addStringSelector(gbox,__tr2qs_ctx("<b>http://</b> handler command:","options"),KviOption_stringUrlHttpCommand);
	m_pHttpHandler->setMinimumLabelWidth(225);
	m_pHttpsHandler=addStringSelector(gbox,__tr2qs_ctx("<b>https://</b> handler command:","options"),KviOption_stringUrlHttpsCommand);
	m_pHttpsHandler->setMinimumLabelWidth(225);
	m_pFtpHandler=addStringSelector(gbox,__tr2qs_ctx("<b>ftp://</b> handler command:","options"),KviOption_stringUrlFtpCommand);
	m_pFtpHandler->setMinimumLabelWidth(225);
	m_pMailtoHandler=addStringSelector(gbox,__tr2qs_ctx("<b>mailto:</b> handler command:","options"),KviOption_stringUrlMailtoCommand);
	m_pMailtoHandler->setMinimumLabelWidth(225);
	m_pFileHandler=addStringSelector(gbox,__tr2qs_ctx("<b>file://</b> handler command:","options"),KviOption_stringUrlFileCommand);
	m_pFileHandler->setMinimumLabelWidth(225);
	m_pOtherHandler=addStringSelector(gbox,__tr2qs_ctx("Unknown protocol handler command:","options"),KviOption_stringUrlUnknownCommand);
	m_pOtherHandler->setMinimumLabelWidth(225);

#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
	m_pHttpHandler->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseSystemUrlHandlers));
	m_pHttpsHandler->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseSystemUrlHandlers));
	m_pFtpHandler->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseSystemUrlHandlers));
	m_pFileHandler->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseSystemUrlHandlers));
	m_pMailtoHandler->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseSystemUrlHandlers));
	m_pOtherHandler->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseSystemUrlHandlers));
	connect(b,SIGNAL(toggled(bool)),this,SLOT(toggleEditors(bool)));
#endif

	addRowSpacer(0,START_ROW+6,0,START_ROW+6);
}
Esempio n. 14
0
int GFFFile::endwrite(uint8 **mem, uint32 *size)
{
	if((datas.size() != datac.size()) || (datas.size() != dataoffs.size()) ||
	   (datas.size() != datasizes.size()))
		return errcode = 25;
	for(uint32 i=0;i<structs.size();i++)
	{
		if((structs[i].fieldcount = structs[i].values.size()) > 1)
			fieldidxsize += structs[i].fieldcount*4;
		// Yeah, I know this is kind of a bad hack, but I need it that way...
		for(uint32 j=0;j<structs[i].labels.size();j++)
			if(structs[i].labels[j] == (std::string *) -1)
				structs[i].labels[j] = (std::string *) (uint64) addLabel("");
	}
	for(uint32 i=0;i<lists.size();i++)
		listidxsize += lists[i].size()*4 + 4;
	structcount = structs.size();
	labelcount = labels.size();
	offstruct = 56;
	offfield = offstruct + structcount*12;
	offlabel = offfield + fieldcount*12;
	offfielddata = offlabel + labelcount*16;
	offfieldidx = offfielddata + fielddatasize;
	offlistidx = offfieldidx + fieldidxsize;

	if(finalWriteHeader()) return errcode;
	if(finalWriteData()) return errcode;
	if(finalWriteLists()) return errcode;
	if(finalWriteLabels()) return errcode;
	if(finalWriteStructs()) return errcode;
	deInit();
	if(mem) *mem = getMem();
	if(size) *size = getMemSize();
	return 0;
}
Esempio n. 15
0
/* Label CFG section end */
static int labelEndSectionCallback(void *data)
{
    int ret;
    LabelParserPayload *payload = (LabelParserPayload*)data;
    
    if(0x03 != payload->flag)
    {
        if(0 == (payload->flag & 0x01))
        {
            ERROR_MSG("Missing physical address for %s", payload->name);
        }
        if(0 == (payload->flag & 0x02))
        {
            ERROR_MSG("Missing logical address for %s", payload->name);
        }
        return 0;
    }
    
    ret = addLabel(payload->repository, payload->name, payload->logical, payload->physical);
    if(ret < 0)
    {
        ERROR_MSG("Duplicate label %s.", payload->name);
        return 0;
    }
    else if(ret == 0)
    {
        ERROR_MSG("An error occured while adding label %s to repository.", payload->name);
        return 0;
    }
    return 1;
}
Esempio n. 16
0
void loadLabelArray(char * fname) {
    FILE * fd = fopen(fname, "r");
    char lname[100];
    unsigned int laddr;
    while(fscanf(fd,"%s %x\n", lname, &laddr) != EOF) {
        addLabel(lname, laddr, -1);
    }
}
Esempio n. 17
0
OptionsWidget_channelAdvanced::OptionsWidget_channelAdvanced(QWidget * pParent)
: KviOptionsWidget(pParent)
{
	createLayout();

	KviBoolSelector * b = addBoolSelector(0,0,4,0,__tr2qs_ctx("Log joined channels history","options"),KviOption_boolLogChannelHistory);

	addLabel(0,1,0,1,__tr2qs_ctx("Default ban mask:","options"));

	m_pBanTypeCombo = new QComboBox(this);
	addWidgetToLayout(m_pBanTypeCombo,1,1,4,1);

	KviIrcMask hostmask("[email protected]");
	KviIrcMask ipmask("[email protected]");
	QString tmp1;
	QString tmp2;
	for(int i=0;i<=26;i++)
	{

		hostmask.mask(tmp1,(KviIrcMask::MaskType)i);
		ipmask.mask(tmp2,(KviIrcMask::MaskType)i);
        m_pBanTypeCombo->insertItem(m_pBanTypeCombo->count(),QString("%1 (%2)").arg(tmp1, tmp2));
	}
	m_pBanTypeCombo->setCurrentIndex(KVI_OPTION_UINT(KviOption_uintDefaultBanType));

	KviTalGroupBox * g = addGroupBox(0,2,4,2,Qt::Horizontal,__tr2qs_ctx("On Channel Join","options"));
	KviUIntSelector *u = addUIntSelector(g,__tr2qs_ctx("Minimum delay between two channel requests:","options"),KviOption_uintOnJoinRequestsDelay,0,10,1);
	u->setSuffix(__tr2qs_ctx(" sec","options"));
	mergeTip(u,__tr2qs_ctx("<center>This is an artificial delay for the channel requests made on join.<br>You may increase it if your server complains about flooding when joining many channels at once.<br>Minimum value: <b>0 secs</b><br>Maximum value: <b>10 secs</b></center>","options"));

	addBoolSelector(g,__tr2qs_ctx("Do not send /WHO request","options"),KviOption_boolDisableWhoRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request ban list","options"),KviOption_boolDisableBanListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request ban exception list","options"),KviOption_boolDisableBanExceptionListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request invite list","options"),KviOption_boolDisableInviteListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request quiet ban list","options"),KviOption_boolDisableQuietBanListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Echo channel topic","options"),KviOption_boolEchoNumericTopic);
	addBoolSelector(g,__tr2qs_ctx("Show channel sync time","options"),KviOption_boolShowChannelSyncTime);

	b = addBoolSelector(g,__tr2qs_ctx("Paste last channel log","options"),KviOption_boolPasteLastLogOnChannelJoin);

	KviTalHBox * box = new KviTalHBox(g);
	u = addUIntSelector(box,__tr2qs_ctx("Paste up to:","options"),KviOption_uintLinesToPasteOnChannelJoin,0,50,10,KVI_OPTION_BOOL(KviOption_boolPasteLastLogOnChannelJoin));
	u->setSuffix(__tr2qs_ctx(" lines","options"));
	mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>0 lines</b><br>Maximum value: <b>50 lines</b></center>","options"));
	connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
	u = addUIntSelector(box,__tr2qs_ctx("Interval:","options"),KviOption_uintDaysIntervalToPasteOnChannelJoin,1,10,10,KVI_OPTION_BOOL(KviOption_boolPasteLastLogOnChannelJoin));
	u->setSuffix(__tr2qs_ctx(" days","options"));
	mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>0 days</b><br>Maximum value: <b>10 days</b></center>","options"));
	connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));

 	b = addBoolSelector(0,3,4,3,__tr2qs_ctx("Keep away list updated","options"),KviOption_boolEnableAwayListUpdates);
	mergeTip(b,
		__tr2qs_ctx("<center>KVIrc sends out a channel /WHO message every now and then to keep " \
			"the channel away list in sync. Use this option to disable this feature (and to save " \
			"your IRC bandwidth. If the server supports IRCv3.1's away-notify extension, it will be used instead of WHO requests.</center>","options"));

	addRowSpacer(0,5,4,5);
}
Esempio n. 18
0
void WayRenderer::label(cairo_t* cr,
		std::list<shared_ptr<Label> >& labels, AssetCache& cache)
{
	if (s->text.str().size() == 0 || s->font_size <= 0.0)
		return;

	// make sure path is initialized
	addWayPath(cr);
	cairo_new_path(cr);

	cairo_save(cr);

	cairo_set_font_size(cr, s->font_size);

	cairo_select_font_face(cr,
				s->font_family.c_str(),
				s->font_style == Style::STYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL,
				s->font_weight == Style::WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL
			);

	cairo_text_extents_t textSize;
	cairo_text_extents(cr, s->text.c_str(), &textSize);

	if (s->text_position == Style::POSITION_CENTER)
	{
		// request a centered label
		addLabel(labels, bounds.getCenter() + FloatPoint(0.0, s->text_offset), &textSize);
	}
	else if (s->text_position == Style::POSITION_LINE)
	{
		FloatPoint best;
		double angle = 0;
		bool placed = getTextPosition(path, textSize.width, best, angle);

		if (placed) {
			cairo_translate(cr, best.x, best.y);
			cairo_rotate(cr, angle);
			cairo_translate(cr, 0, s->text_offset);

			cairo_move_to(cr, -textSize.width/2.0 - textSize.x_bearing,
						-textSize.height/2.0 - textSize.y_bearing);

			cairo_text_path(cr, s->text.c_str());

			if (s->text_halo_radius > 0.0)
			{
				cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
				cairo_set_line_width(cr, s->text_halo_radius*2.0);
				cairo_set_source_rgba(cr, COLOR2RGBA(s->text_halo_color));
				cairo_stroke_preserve(cr);
			}
			cairo_set_source_rgba(cr, COLOR2RGBA(s->text_color));
			cairo_fill(cr);
		}
	}

	cairo_restore(cr);
}
Esempio n. 19
0
bool InputLine::addLabel(char* text){
	int length = strlen(text);
	int start = findSpace(length) + 1;
	if(start != 0){
		return addLabel(start, text);
	} else {
		return false;
	}
}
Esempio n. 20
0
void LabelWidget::addLabel(QTreeWidgetItem* parent, Label* label)
{
	for (int i = 0; i < label->childCount(); ++i)
	{
		QTreeWidgetItem* item = new QTreeWidgetItem((QTreeWidget*)0, QStringList(label->getChild(i)->getText()));
		parent->addChild(item);
		addLabel(item, label->getChild(i));
	}
}
OptionsWidget_privmsg::OptionsWidget_privmsg(QWidget * parent)
: KviOptionsWidget(parent)
{
	setObjectName("privmsg_options_widget");
	createLayout();

	KviTalGroupBox * g = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("General","options"));

	addBoolSelector(g,__tr2qs_ctx("Show message icons","options"),KviOption_boolIrcViewShowImages);
	addBoolSelector(g,__tr2qs_ctx("Draw some emoticons (smileys) as pictures","options"),KviOption_boolDrawEmoticons);
	addBoolSelector(g,__tr2qs_ctx("Don't show colors in user messages","options"),KviOption_boolStripMircColorsInUserMessages);

	g = addGroupBox(0,1,0,1,Qt::Horizontal,__tr2qs_ctx("Nicknames","options"));

	m_pUseSmartColorSelector = addBoolSelector(g,__tr2qs_ctx("\"Smart\" nickname colors","options"),KviOption_boolColorNicks);

	KviTalHBox * hb = new KviTalHBox(g);
	hb->setSpacing(4);
	m_pSpecialSmartColorSelector = addBoolSelector(hb,__tr2qs_ctx("Use specified colors for own nick:","options"),KviOption_boolUseSpecifiedSmartColorForOwnNick,KVI_OPTION_BOOL(KviOption_boolColorNicks));

	m_pSmartColorSelector = addMircTextColorSelector(hb,"",KviOption_uintUserIrcViewOwnForeground,KviOption_uintUserIrcViewOwnBackground,KVI_OPTION_BOOL(KviOption_boolColorNicks) && KVI_OPTION_BOOL(KviOption_boolUseSpecifiedSmartColorForOwnNick));

	connect(m_pSpecialSmartColorSelector,SIGNAL(toggled(bool)),this,SLOT(enableDisableSmartColorSelector(bool)));
	connect(m_pUseSmartColorSelector,SIGNAL(toggled(bool)),m_pSpecialSmartColorSelector,SLOT(setEnabled(bool)));

	KviBoolSelector * b2 = addBoolSelector(g,__tr2qs_ctx("Use same colors as in the userlist","options"),KviOption_boolUseUserListColorsAsNickColors,!KVI_OPTION_BOOL(KviOption_boolColorNicks));
	connect(m_pUseSmartColorSelector,SIGNAL(toggled(bool)),b2,SLOT(setNotEnabled(bool)));

	addBoolSelector(g,__tr2qs_ctx("Show nicknames in bold","options"),KviOption_boolBoldedNicks);
	addBoolSelector(g,__tr2qs_ctx("Show user and host","options"),KviOption_boolShowUserAndHostInPrivmsgView);
	addBoolSelector(g,__tr2qs_ctx("Show channel mode prefix","options"),KviOption_boolShowChannelUserFlagInPrivmsgView);
	KviBoolSelector * b = addBoolSelector(g,__tr2qs_ctx("User-defined prefix and postfix","options"),KviOption_boolUseExtendedPrivmsgView);

	QLabel * l = addLabel(g,__tr2qs_ctx("[PREFIX]nickname[!user@host][POSTFIX] message","options"));

	l->setEnabled(KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView));
	connect(b,
		SIGNAL(toggled(bool)),
		l,
		SLOT(setEnabled(bool)));

	KviTalVBox * vb = new KviTalVBox(g);
	vb->setSpacing(5);

	connect(
		b,
		SIGNAL(toggled(bool)),
		addStringSelector(vb,__tr2qs_ctx("Prefix:","options"),KviOption_stringExtendedPrivmsgPrefix,KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView)),
		SLOT(setEnabled(bool)));
	connect(
		b,
		SIGNAL(toggled(bool)),
		addStringSelector(vb,__tr2qs_ctx("Postfix:","options"),KviOption_stringExtendedPrivmsgPostfix,KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView)),
		SLOT(setEnabled(bool)));
	addRowSpacer(0,3,0,3);
}
Esempio n. 22
0
/** Calculate the the number of holes in the object o of the image i 
 * The function attempts to reverse the idea of sequential labeling 
 * in order to find black spots on objects
 * It still needs work.
 * TODO Make this work properly
 * */
void euler(Image *im, Object *o)
{
	int i, j, k, c, neighbors[NNEIGHB], 
		 newObj, left, right;

	LabelMap lm=makeLabelMap(im);

	/* this sets up a dummy class for background darkness */
	addLabel(&lm);
	for (i=0; i < getNRows(im); ++i)
		for (j=0; j < getNCols(im); ++j)
			if (!getPixel(im, i, j)) setLabel(&lm, i, j, 1);

	for (i=o->top; i <= o->bottom; ++i) {
		left=-1;
		for (j=o->left; j <= o->right; ++j) {
			if (getPixel(im, i, j) == o->label) {
				if (left < 0) left=j; /* left edge for this row */
				right=j; /* right-most so far */
			} 
		}
		for (j=left; j <= right; ++j) {
			if (!getPixel(im, i, j)) {
				newObj=getNeighbors(&lm, i, o->top, j, left, neighbors);
				if (newObj) {
					addLabel(&lm);
					c=getNLabels(&lm);
				} else {
					for (k=0; k < NNEIGHB; ++k)
						if (neighbors[k] > 0) {
							c=evalNeighbor(k, &lm, neighbors);
							break; /* break since finding one means checking the rest */
						}
				}
				setLabel(&lm, i, j, c);
			}
		}
	}

	o->holes=getNClasses(&lm)-1; /* number is off by one because of dummy class */
	freeLabelMap(&lm);
}
Esempio n. 23
0
ramPresetTab::ramPresetTab()
:ofxUITab("Presets", false)
,preset_cam_index(1)
,use_node_cam(false)
,cam_position(false)
,cam_look_at(false)
{
	// should probably be a list of named presets instead of a grid
    addLabelButton("Line", false);
    addLabelButton("Hasty Chase", false);
    addLabelButton("HC + Stamp", false);
    addLabelButton("HC + Stamp + Natto", false);
    addLabelButton("HC + Future", false);
	addLabelButton("Line + Future", false);
// ignore win32
#ifndef TARGET_WIN32
	addLabelButton("Particles + Future", false);
	addLabelButton("Particles", false);
#else
	addLabelButton("Future", false); // only for windows
#endif
	addSpacer();
	
	vector<string> cameraPresetNames;
	cameraPresetNames.push_back("Low");
	cameraPresetNames.push_back("High");
	cameraPresetNames.push_back("Overhead");
	preset_cam_radio = addRadio("Camera position", cameraPresetNames);
	preset_cam_radio->getToggles()[preset_cam_index]->setValue(true);
	addSpacer();
	
    // nodecam
    addLabel("NodeCam", OFX_UI_FONT_LARGE);
    addLabel("1. Click a node on actor", OFX_UI_FONT_SMALL);
    addLabel("which you want to set as", OFX_UI_FONT_SMALL);
    addLabel("camera pos or lookAt.", OFX_UI_FONT_SMALL);
    
    addLabel("2. Click a button below.", OFX_UI_FONT_SMALL);
    addLabel("a joint with red circle", OFX_UI_FONT_SMALL);
    addLabel("will be set as pos or lookAt.", OFX_UI_FONT_SMALL);
    addButton("Set Camera Position", &cam_position, 15, 15);
    addButton("Set Camera LookAt", &cam_look_at, 15, 15);
    
    addLabel("3. Enable NodeCam.", OFX_UI_FONT_SMALL);
    addToggle("Enable Node Cam", &use_node_cam, 30, 30);
    
	autoSizeToFitWidgets();
	
	ofAddListener(ofEvents().update, this, &ramPresetTab::update);
	ofAddListener(ofEvents().draw, this, &ramPresetTab::draw);
	ofAddListener(newGUIEvent, this, &ramPresetTab::guiEvent);
}
Esempio n. 24
0
OptionsWidget_sounds::OptionsWidget_sounds(QWidget * parent)
: KviOptionsWidget(parent)
{
	setObjectName("sound_options_widget");
	createLayout();
	addLabel(0,0,0,0,__tr2qs_ctx("New Query opened","options"));
	addSoundSelector(1,0,1,0,"",KviOption_stringOnNewQueryOpenedSound);

	addLabel(0,1,0,1,__tr2qs_ctx("New message in inactive query","options"));
	addSoundSelector(1,1,1,1,"",KviOption_stringOnQueryMessageSound);

	addLabel(0,2,0,2,__tr2qs_ctx("Highlighted message in inactive window","options"));
	addSoundSelector(1,2,1,2,"",KviOption_stringOnHighlightedMessageSound);

	addLabel(0,3,0,3,__tr2qs_ctx("Me have been kicked","options"));
	addSoundSelector(1,3,1,3,"",KviOption_stringOnMeKickedSound);

	addRowSpacer(0,4,1,4);

}
Esempio n. 25
0
void CpuView::addDisplay()
{
  CpuList::Iterator it;
  for (it = m_cpus.begin(); it != m_cpus.end(); ++it) {
    KSim::Progress *progress = addLabel();
    KSim::Chart *chart = addChart();
    //KSim::Progress *progress = addLabel();

    (*it).setDisplay(chart, progress);
  }
}
Esempio n. 26
0
void PointStyleBuilder::addPolygon(const Polygon& _polygon, const Properties& _props,
                                   const DrawRule& _rule) {

    PointStyle::Parameters p = applyRule(_rule, _props);
    glm::vec4 uvsQuad;

    if (!getUVQuad(p, uvsQuad)) {
        return;
    }

    if (!p.centroid) {

        int size = 0;
        for (auto line : _polygon) { size += line.size(); }

        for (auto line : _polygon) {
            for (auto point : line) {
                Label::Transform transform = { glm::vec2(point) };

                addLabel(transform, p.size, *m_mesh, m_vertices.size(),
                         p.labelOptions, p.extrudeScale, p.anchor);

                pushQuad(m_vertices, p.size,
                         {uvsQuad.x, uvsQuad.y},
                         {uvsQuad.z, uvsQuad.w},
                         p.color, p.extrudeScale);
            }
        }
    } else {
        glm::vec2 c = centroid(_polygon);
        Label::Transform transform = { c };

        addLabel(transform, p.size, *m_mesh, m_vertices.size(),
                 p.labelOptions, p.extrudeScale, p.anchor);

        pushQuad(m_vertices, p.size,
                 {uvsQuad.x, uvsQuad.y},
                 {uvsQuad.z, uvsQuad.w},
                 p.color, p.extrudeScale);
    }
}
Esempio n. 27
0
OptionsWidget_tools::OptionsWidget_tools(QWidget * parent)
    : KviOptionsWidget(parent)
{
	setObjectName("tools_options_widget");
	createLayout();

	addLabel(0, 0, 0, 0, __tr2qs_ctx("This section contains IRC tools "
	                                 "like <b>away, lag and logging system</b>. ",
	                         "options"));

	addRowSpacer(0, 1, 0, 1);
}
Esempio n. 28
0
bool
CVML::
readData(CFile *file)
{
  uint size;

  if (! file->read((uchar *) &size, sizeof(size)))
    return false;

  uint size1 = 0;

  uint num_data;

  if (! file->read((uchar *) &num_data, sizeof(num_data)))
    return false;

  size1 += sizeof(num_data);

  for (uint i = 0; i < num_data; ++i) {
    uint id;

    if (! file->read((uchar *) &id, sizeof(id)))
      return false;

    size1 += sizeof(id);

    CVMLStringId id1 = id;

    uint size2;

    CVMLData *data = CVMLData::read(*this, file, &size2);

    if (data == NULL)
      return false;

    size1 += size2;

    CVMLLabel *label = lookupLabelById(id1);

    if (label == NULL)
      label = addLabel(id1, data->getPC());

    CVMLLine *line = new CVMLLine(label, data);

    addLine(line);
  }

  if (size1 != size)
    return false;

  return true;
}
Esempio n. 29
0
bool SES_AddNetLabel::entry(SEE_Base* event) noexcept
{
    Q_UNUSED(event);
    Schematic* schematic = mEditor.getActiveSchematic();
    if (!schematic) return false;

    if (!addLabel(*schematic)) return false;

    // Check this state in the "tools" toolbar
    mEditorUi.actionToolAddNetLabel->setCheckable(true);
    mEditorUi.actionToolAddNetLabel->setChecked(true);
    return true;
}
Esempio n. 30
0
bool
CVML::
readDebug(CFile *file)
{
  uint size;

  if (! file->read((uchar *) &size, sizeof(size)))
    return false;

  uint size1 = 0;

  uint num_labels;

  if (! file->read((uchar *) &num_labels, sizeof(num_labels)))
    return false;

  size1 += sizeof(num_labels);

  for (uint i = 0; i < num_labels; ++i) {
    CVMLStringId id;

    if (! file->read((uchar *) &id, sizeof(id)))
      return false;

    size1 += sizeof(id);

    uint line_num;

    if (! file->read((uchar *) &line_num, sizeof(line_num)))
      return false;

    size1 += sizeof(line_num);

    uint pc;

    if (! file->read((uchar *) &pc, sizeof(pc)))
      return false;

    size1 += sizeof(pc);

    CVMLLabel *label = addLabel(id, pc);

    label->setLineNum(line_num);
  }

  if (size != size1)
    return false;

  return true;
}