| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 
 | __fastcall TVipReportMain::TVipReportMain(TComponent* Owner, TWinControl * parentDroite,
        TWinControl * parentGauche, const Patient & PatientArg, TLabel *barre_aide,
        vector <Image*> Images,vector <Video*> Videos,
        TfListeCategories * listeCat) : TForm(Owner),PatientL(PatientArg),ExamenL(PatientArg.GetExamenCourant())
{       // Initialisations des variables membres
        ancienneWidth = 0;
 
        // Gère un recdrage pour voir l'ensemble de la page
        // On considère que 650+/-30 pixels sont nécessaires pour obtenir une page
        // visible correcte et 230 pixels necessaire pour le panel de gauche.
        if(((int)(Screen->Width)*0.84 - 650) >230)
                parentGauche->Width = ((int)(Screen->Width)*0.84 - 650);
        else
                parentGauche->Width = 230;
 
        images = NULL;
        Droite = parentDroite;
        truc = false;
        flagErreurEnr = false;
        ReportControlPanel->Parent = parentGauche;
        ReportControlPanel->Align = alClient;
        JusteImprime = false;
        JusteEnresgitredxCare = false;
        TypePageEnCours ="";
        ItePageEnCours=-1;
        EnCours = 1;
        FirstOpen = true;
 
        //------ Initialisation du patient
        Donnee::PtGestionnaireBase  = (GestionnaireFireBird *)PatientArg.ptGestionnaire;
        fListeCategories = listeCat;
 
        TIniFile * iniDataPath = new TIniFile(ExtractFileDir(Application->ExeName)+"\\VIP_Config\\VIP4000.ini");
        CheminServeur = IncludeTrailingPathDelimiter(iniDataPath->ReadString("Chemins", "Data", ""));
        delete iniDataPath;
 
        pRepMesures = new TRepMesures();
        pRepMesures->SetXMLFile(ExtractFilePath(Application->ExeName) + AnsiString("Rapport\\echocard_cat.xml"),PatientArg,ExamenL);
        FillRepMesuresWithDB(pRepMesures);
 
        pFrmCategorySelector = new TfrmCategorySelector(this);
        pFrmCategorySelector->Parent = ReportControlPanel;
        pFrmCategorySelector->Align = alClient;
        pFrmCategorySelector->RepMesures = this->pRepMesures;
 
        //************************************* Version visualisation *******************
        // Si c'est une session de travail, on bloque tout...
 
        ConstruireVisualisation();
        ConstruireEdition(Images);
 
        //** Construction des panels de visualisation d'image et de vidéos.
        // Pour la vidéo
        PanelListeVDO->Parent = Boucles;
        PanelListeVDO->Width = Boucles->Width;
        PanelListeVDO->Height = Boucles->Height;
        TabImgVdo->TabWidth = TabImgVdo->Width/2 - 3;
        ImageListVDO->Width = Boucles->Width /3;
        ImageListVDO->Height = Boucles->Height/4 ;
 
        // Pour les images
        pImages->Width = 490;
        images = new TFListeImagesRapport(this,Images);
        images->Parent = pImages;
        images->affichage(pImages);
 
        EditionVisual->Top = 26;
        EditionVisual->Left = 0;
 
        vids = Videos;
 
        PanelApercu->OnDblClick = VideoDblClick;
 
        TabImgVdo->OnResize = TabImgVdoResize;
}
 
// Fonctions appelées par le constructeur pour le "soulager" un peu. Construit le doc de visualisation
void __fastcall TVipReportMain::ConstruireVisualisation()
{       ViewVisual = new TVipRepView2(this);
        ViewVisual->Parent = Visualisation;
        ViewVisual->Top = 3;
        ViewVisual->Left = 5;
        ViewVisual->Height = this->ClientHeight - ViewVisual->Top - 3;
        ViewVisual->Width = this->ClientWidth - ViewVisual->Left - 3;
        ViewVisual->Anchors = ViewVisual->Anchors << akLeft << akTop << akRight << akBottom;
        ViewVisual->Align = alClient;
 
        TReportDocument * pDoc1 = new TReportDocument(this, PatientL, ExamenL, pRepMesures);
        ViewVisual->Document = pDoc1;
        ViewVisual->Document->Type = "Visualisation";
        ViewVisual->ZoomFactor *= 0.788;
        ViewVisual->Show();
}
 
 
// Construit le doc d'édition
void __fastcall TVipReportMain::ConstruireEdition(vector<Image*> Images)
{       // Mise en place des caractéristiques du TvipRepView2
        ViewEdition = new TVipRepView2(this);
        ViewEdition->Parent = Edition;
        ViewEdition->Top = 3;
        ViewEdition->Left = 5;
        ViewEdition->Height = this->ClientHeight - ViewEdition->Top - 3;
        ViewEdition->Width = this->ClientWidth - ViewEdition->Left - 3;
        ViewEdition->Anchors = ViewEdition->Anchors << akLeft << akTop << akRight << akBottom;
        ViewEdition->Align = alClient;
 
        // creation d'un nouveau document
        TReportDocument * pDoc = new TReportDocument(this, PatientL, ExamenL, pRepMesures);
 
        // assignation du document à la vue
        ViewEdition->Document = pDoc;
        ViewEdition->Document->Type = "Edition";
 
        // Chargement du XML
        ViewEdition->Visible = false;   // On masque pour accélerrer le chargement.
        // Si un xml existe déjà pour cet examen et ce patient, on le charge sinon on charge le fichier standard
        AnsiString cheminAncienXML =    CheminServeur + IncludeTrailingPathDelimiter(PatientL.GetNomDossier().c_str()) +
                                        ExamenL.GetDate().FormatString("mm'_'dd'_'yyyy") + AnsiString("\\") +
                                        IntToStr(ExamenL.gettype()) + AnsiString("\\Rapport\\rapport.xml");
        bool t=false;
        if (FileExists(cheminAncienXML))
        {      try{    ViewEdition->Document->LoadXML(cheminAncienXML, false);         }
               catch(...)
               {MessageBox(NULL,"Erreur: le XML n'a pas pu se charger correctement. il est possible qu'il soit corrompu. ","Erreur",MB_OK);}
        }
        else
        {       try
                {       t = true;
                        ViewEdition->Document->LoadXML(ExtractFilePath(Application->ExeName) + AnsiString("Rapport\\rapport_cardio.xml"), false);
                }
                catch(...)
               {MessageBox(NULL,"Erreur: le XML n'a pas pu se charger correctement. il est possible qu'il soit corrompu. ","Erreur",MB_OK);}
        }
 
 
        ViewEdition->ZoomFactor *= 0.788;
        ViewEdition->Document->Editable = true; // On veut que le rapport soit modifiable
 
        ViewEdition->Show();
        pFrmCategorySelector->DocumentView = ViewEdition; // On lie le Category Selector au document pour qu'il puisse charger automatiquement les changements
 
      // Si je place le code ici, il fonctionne bien ...
 
      /* if (t)
        {
                // **** Importation des images dans la page des images
                // Tout d'abord ajout d'une page de type Images
                // /!\ on ajoute une page d'images même si il n'y a pas d'images dans le vecteur car il faut une page ou les utilisateurs pourront glisser imgs et vidéos.
                ViewEdition->Document->AddPageLast();
                ViewEdition->Document->Pages[ViewEdition->Document->NumPages-1]->Type = "Images";
                // initialisation de x et de y pour la position des images dans la page
                int xtmp = 30;
                int ytmp = 75;  // Cela permet seulement placer automatiquement la première image dans la page d'image.
                int cpt=0;      // ce compteur permet de savoir combien d'images il y a dans la page, pour la mise ne page
                int IS=Images.size();
 
                for (int i = 1; i<= IS; i++)
                {      // if ( Images.at(i)->GetLabel() == "                ")
                        {
                                cpt++;
                                TReportImage * pImg;
                                pImg = new TReportImage(ViewEdition->Document->Pages[ViewEdition->Document->NumPages-1]);
 
                                pImg->height = 200;
                                pImg->width = 250;
                                if (cpt%2==0)
                                pImg->x = xtmp + 330;
                                else pImg->x = xtmp;
                                if (cpt%2!=0)
                                ytmp += 250;
                                pImg->y =ytmp;
                                pImg->SetBitmap(Images[cpt]->GetTampon());
                                pImg->FileName =(AnsiString)(Images[cpt]->GetChemin()).c_str();
 
                                // si la page est pleine(6images déjà) et qu'il reste des images à ajouter: ajouter une nouvelle^page de type "Images"
                                if (i>6)
                                {       cpt = 0;
                                        ViewEdition->Document->AddPageLast();
                                        ViewEdition->Document->Pages[ViewEdition->Document->NumPages-1]->Type = "Images";
                                        ytmp = 75;
                                }
 
                        }
                MessageBox(NULL,IntToStr(i).c_str(),"Erreur",MB_OK);
                }
        }       */
        ViewEdition->Document->VoirCouleur();
        ViewEdition->Document->BoiteImgPrVCourte = true;
        ViewEdition->Document->BoiteImgPrVCourte = false;
 
        ViewEdition->Document->Refresh(2);
        ViewEdition->RefreshScroolBox();
        ViewEdition->Visible = true;
}
 
__fastcall TVipReportMain::~TVipReportMain()
{       //monListeImages->Parent = Stock;
        if (images)     delete images;
        images = NULL;
 
        // Mise à jour dans la base de données
        EnregistrementMesuresDB(pRepMesures->pRootCat);
        saveRapportAuto();
} | 
Partager