Changeset 718 for cpp/frams


Ignore:
Timestamp:
12/21/17 21:45:54 (6 years ago)
Author:
Maciej Komosinski
Message:

Fixed order of constructor calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/canvas/neurodiagram.cpp

    r348 r718  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2017  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    6969
    7070NeuroDiagram::NeuroDiagram(ColorDefs *cd)
    71 :FramDrawToolkit(cd), livewire(false), indestructor(false), showing_not_alive_label(false), o(0),
    72 warn_if_not_alive(true), selection(*this), drawbackground(true), linetype(true), layouttype(2)
     71        :FramDrawToolkit(cd), livewire(false), indestructor(false), showing_not_alive_label(false), o(0),
     72        warn_if_not_alive(true), selection(*this), drawbackground(true), linetype(true), layouttype(2)
    7373{
    7474        scroll.setMargin(10, 10); // appropriate size should be adjusted
     
    9191        showing_not_alive_label = 0;
    9292        if (o) o->delmodel_list.remove(killnode);
    93         FOREACH(NeuroProbe*,pr,probes)
     93        FOREACH(NeuroProbe*, pr, probes)
    9494                delete pr;
    9595        probes.clear();
     
    244244
    245245NeuroSymbol::NeuroSymbol(NeuroDiagram &nd, Neuro * _n)
    246         :selected(0), n(_n), diagram(nd), FramDrawToolkit(nd.getColorDefs())
     246        :FramDrawToolkit(nd.getColorDefs()), selected(0), n(_n), diagram(nd)
    247247{
    248248        tooltip = "#";
     
    287287        }
    288288
    289 /*
    290 
    291             NeuroDiagram
    292             *........................................
    293             .                                       .
    294             .                    NeuroSymbol        .
    295             .      (pos.x,pos.y)-*.........         .
    296             .                    . |\     . ^  s    .
    297             .            ..._____._| \    . |  i    .
    298             .                    . |  \___. |  z    .
    299             .                  __._|  /   . |  e    .
    300             .                 |  . | /    . |  .    .
    301             .                 |  . |/     . |  y    . 
    302             .                 |  .......... v       . 
    303             .                 |  <-------->         . 
    304             .      .......... |    size.x           .
    305             .      . |\     . |                     .
    306             .    __._| \    . |                     .
    307             .      . |  \___._|                     .
    308             .    __._|  /   .                       .
    309             .   |  . | /    .                       .
    310             .   |  . |/     .                       .
    311             .   |  ..........                       .
    312             .   |                                   .
    313             .   |________________...                .
    314             .........................................
    315 
    316  */
     289        /*
     290
     291                                NeuroDiagram
     292                                *........................................
     293                                .                                       .
     294                                .                    NeuroSymbol        .
     295                                .      (pos.x,pos.y)-*.........         .
     296                                .                    . |\     . ^  s    .
     297                                .            ..._____._| \    . |  i    .
     298                                .                    . |  \___. |  z    .
     299                                .                  __._|  /   . |  e    .
     300                                .                 |  . | /    . |  .    .
     301                                .                 |  . |/     . |  y    .
     302                                .                 |  .......... v       .
     303                                .                 |  <-------->         .
     304                                .      .......... |    size.x           .
     305                                .      . |\     . |                     .
     306                                .    __._| \    . |                     .
     307                                .      . |  \___._|                     .
     308                                .    __._|  /   .                       .
     309                                .   |  . | /    .                       .
     310                                .   |  . |/     .                       .
     311                                .   |  ..........                       .
     312                                .   |                                   .
     313                                .   |________________...                .
     314                                .........................................
     315
     316                                */
    317317
    318318        // NeuroSymbol is also responsible for drawing connection lines from its inputs to other NeuroSymbols' outputs
     
    416416{
    417417        if ((y >= 0) && (y < size.y))
    418                 if (x<size.x / 4)
     418                if (x < size.x / 4)
    419419                { // inputs?
    420                         if (n->getInputCount()>0)
     420                if (n->getInputCount() > 0)
     421                {
     422                        int i = (y*n->getInputCount()) / size.y;
     423                        double w;
     424                        Neuro* target = n->getInput(i, w);
     425                        if (target)
    421426                        {
    422                                 int i = (y*n->getInputCount()) / size.y;
    423                                 double w;
    424                                 Neuro* target = n->getInput(i, w);
    425                                 if (target)
     427                                SString t = "connected to #";
     428                                t += SString::valueOf((int)target->refno);
     429                                t += " - ";
     430                                addNeuroDescription(t, target);
     431                                //              if (w!=1.0)
    426432                                {
    427                                         SString t = "connected to #";
    428                                         t += SString::valueOf((int)target->refno);
    429                                         t += " - ";
    430                                         addNeuroDescription(t, target);
    431                                         //              if (w!=1.0)
    432                                         {
    433                                                 t += ", weight=";
    434                                                 t += SString::valueOf(w);
    435                                         }
    436                                         return t;
     433                                        t += ", weight=";
     434                                        t += SString::valueOf(w);
    437435                                }
     436                                return t;
    438437                        }
    439438                }
     439                }
    440440        return CanvasWindow::hint(x, y);
    441441}
     
    444444
    445445NeuroProbe::NeuroProbe(NeuroSymbol* ns)
    446 :DCanvasWindow(DCanvasWindow::Title + DCanvasWindow::Border + DCanvasWindow::Close + DCanvasWindow::Size,
    447   ns->getLabel().c_str(), &neurochart, &neurochart)
     446        :DCanvasWindow(DCanvasWindow::Title + DCanvasWindow::Border + DCanvasWindow::Close + DCanvasWindow::Size,
     447        ns->getLabel().c_str(), &neurochart, &neurochart)
    448448{
    449449        holdismine = 0;
     
    683683void NeuroDiagram::probeSampling(void*obj, intptr_t dummy)
    684684{
    685         FOREACH(NeuroProbe*,pr,probes) pr->sampling();
     685        FOREACH(NeuroProbe*, pr, probes) pr->sampling();
    686686        requestPaint();
    687687}
Note: See TracChangeset for help on using the changeset viewer.