text object drawing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

text object drawing

gnagno91
Hi!
I created a method split in rs_actiondrawtext class to split lines of text input for a TEXT object. I'm not able to create appropriate independent objects for each, playing with methods in rs_actiondrawtext class. The split method looks like:

QVector<RS_Text*> RS_ActionDrawText::split(RS_Text *pText, RS_EntityContainer* parent){
    int m = 100;
   for(int i = 0; i < pText->getLines().size(); i++) {
        QString line = pText->getLines().at(i);
         RS_Text* t = new RS_Text(parent, pText->getData());
         t->setText(line);
         RS_Vector point((t->getInsertionPoint().x)+m,t->getInsertionPoint().y);
         t->setInsertionPoint(point);
        list.push_back(t);
    }
    return list;
}

I modify the init() function and the preparePreview() function in this way:

void RS_ActionDrawText::init(int status) {
    RS_ActionInterface::init(status);
    if (RS_DIALOGFACTORY!=NULL) {

        switch (status) {
        case ShowDialog: {
                reset();
                RS_Text tmp(NULL, data);
                if (RS_DIALOGFACTORY->requestTextDialog(&tmp)) {
                       data = tmp.getData();
                       list = split(&tmp,container);
                        foreach(RS_Text* t, list){
                            RS_TextData obj(t->getInsertionPoint(),
                                            t->getHeight(),
                                            t->getWidth(),
                                            t->getVAlign(),
                                            t->getHAlign(),
                                            t->getText(),
                                            t->getStyle(),
                                            t->getAngle(),
                                            t->getInclination());
                            dataSplitted.append(obj);
                        }

                        setStatus(SetPos);
                        showOptions();
                } else {
                    hideOptions();
                    setFinished();
                }
            }
            break;

        case SetPos:
            RS_DIALOGFACTORY->requestOptions(this, true, true);
            deletePreview();
            preview->setVisible(true);
            preparePreview();
            break;

        default:
            break;
        }
    }
}
void RS_ActionDrawText::preparePreview() {
    for(int i = 0; i < list.size(); i++){
       RS_Text* text = new RS_Text(preview, dataSplitted.at(i));
        text->update();

        preview->addEntity(text);
        textChanged = false;
   }
    data.insertionPoint = pos;
}

I also added two variable in the class: QVector>RS_Text*> list and QVector<RS_TextData> data.
Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

Rallaz
Hi Luca,

is there any place to see all the code for the implementation of TEXT and MTEXT?
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Here I put the zip file with the work done until today: https://docs.google.com/file/d/0B4NBC6HLgHwWNzZ3cl90a2tteTA/edit.

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Here the link to the lighter zip file: https://docs.google.com/file/d/0B4NBC6HLgHwWbHRnQVgxd3VaYmM/edit

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

dxli
Hi Luca,

I fixed some building issues in the "luca" branch of my repository:

 https://github.com/dxli/LibreCAD/commit/c18ccb4acaa7ebe21aaa6ad769752f01675a11fc

please update to the HEAD of the luca branch:

https://github.com/dxli/LibreCAD/tree/luca

I only fixed stuff clearly broken to me, while leaving you to play with correctness of implementation. I added an ugly mtext icon for the button in cad toolbar main. the source image file is at:

desktop/graphics_program_icons/mtext.svg

to make it look better, you can use inkscape to edit it and export it png picture ( librecad/res/extui/mtext.png ).

Regards,

Dongxu

On Tue, Jun 12, 2012 at 4:51 PM, gnagno91 [via LibreCAD] <[hidden email]> wrote:
Here the link to the lighter zip file: https://docs.google.com/file/d/0B4NBC6HLgHwWbHRnQVgxd3VaYmM/edit

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/text-object-drawing-tp5706744p5706751.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Which command to update the HEAD? git update or something else?

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

dxli
Hi luca,

make sure you have my branch added as a "remote":

git remote add -t luca dxli https://github.com:dxli/LibreCAD.git
git fetch --all
git checkout -f -b dxli-branch dxli/luca

if you already have the remote there, you only have to checkout the branch luca from that remote.

if you already have the branch, simply siwtch to the branch and pull:

git checkout dxli-branch
git pull

Regards,

Dongxu

On Wed, Jun 13, 2012 at 8:08 AM, gnagno91 [via LibreCAD] <[hidden email]> wrote:
Which command to update the HEAD? git update or something else?

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/text-object-drawing-tp5706744p5706755.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Thanks, It seemed something was wrong!

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Hi,
when running git fetch --all it gives me this error:
fatal: <a href="https://github.com:dxli/LibreCAD.git/info/refs">https://github.com:dxli/LibreCAD.git/info/refs not found: did you run git update-server-info on the server?

is that a problem of my machine?

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

dxli
Hi Luca:

why not just git clone:

mkdir dxli
cd dxli
git clone https://github.com:dxli/LibreCAD.git
cd LibreCAD
git checkout luca

or download the zip from github:

https://github.com/dxli/LibreCAD/zipball/luca

Regards,

Dongxu

On Wed, Jun 13, 2012 at 10:54 AM, gnagno91 [via LibreCAD] <[hidden email]> wrote:
Hi,
when running git fetch --all it gives me this error:
fatal: <a href="https://github.com:dxli/LibreCAD.git/info/refs">https://github.com:dxli/LibreCAD.git/info/refs not found: did you run git update-server-info on the server?

is that a problem of my machine?

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/text-object-drawing-tp5706744p5706758.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

dxli
In reply to this post by gnagno91
it should be: https://github.com/dxli/LibreCAD.git

instead of https://github.com:dxli/LibreCAD.git

sorry for that!

Dongxu

On Wed, Jun 13, 2012 at 10:56 AM, Dongxu Li <[hidden email]> wrote:
Hi Luca:

why not just git clone:

mkdir dxli
cd dxli
git clone https://github.com:dxli/LibreCAD.git
cd LibreCAD
git checkout luca

or download the zip from github:

https://github.com/dxli/LibreCAD/zipball/luca

Regards,

Dongxu


On Wed, Jun 13, 2012 at 10:54 AM, gnagno91 [via LibreCAD] <[hidden email]> wrote:
Hi,
when running git fetch --all it gives me this error:
fatal: <a href="https://github.com:dxli/LibreCAD.git/info/refs">https://github.com:dxli/LibreCAD.git/info/refs not found: did you run git update-server-info on the server?

is that a problem of my machine?

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/text-object-drawing-tp5706744p5706758.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org




--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Don't worry! I finally use git clone but it stops compiling at qg_actionfactory.cpp since it say that the RS_ActionDrawMText class has not been declared.

I'll try to fix it.

Thanks,

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

dxli
Hi,

Make sure you clone from my repository. I feel your folder is not clean, because qg_actionfactory.cpp doesn't contain string "mtext" here:

https://github.com/dxli/LibreCAD/blob/luca/librecad/src/ui/qg_actionfactory.cpp

Regards,
Dongxu


On Wed, Jun 13, 2012 at 11:26 AM, gnagno91 [via LibreCAD] <[hidden email]> wrote:
Don't worry! I finally use git clone but it stops compiling at qg_actionfactory.cpp since it say that the RS_ActionDrawMText class has not been declared.

I'll try to fix it.

Thanks,

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/text-object-drawing-tp5706744p5706761.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

gnagno91
Hi,
I will clean my folder asap. I appy your modification and it works, but not yet correctly. I will work on it later.  For tomorrow I will presented the work done and I will explain that we are just concluding the features, saying that my collaboration will continue. For now I will say a big thank you to you and to all the community for the help you gave to me in these months. Anyway, I will continue working on the features I started developing in my free time.

BR

Luca
Reply | Threaded
Open this post in threaded view
|

Re: text object drawing

kevin
i would really appreciate the features i meantioned so i can use this thing with out alot of ddep thought  just to illustrate what i am talking about http://www.facebook.com/photo.php?fbid=333380716735439&set=a.195149723891873.47879.176797659060413&type=1&theater  otherwise this  is how my drawings will look lol 

On Thu, Jun 14, 2012 at 4:22 PM, gnagno91 [via LibreCAD] <[hidden email]> wrote:
Hi,
I will clean my folder asap. I appy your modification and it works, but not yet correctly. I will work on it later.  For tomorrow I will presented the work done and I will explain that we are just concluding the features, saying that my collaboration will continue. For now I will say a big thank you to you and to all the community for the help you gave to me in these months. Anyway, I will continue working on the features I started developing in my free time.

BR

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/text-object-drawing-tp5706744p5706767.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML