# OpenViBE_visual_BCI | |||||
<OpenViBE-Classifier-Box Creator="OpenVIBE" CreatorVersion="2.0.99" FormatVersion="4"> | |||||
<Strategy-Identifier class-id="(0xffffffff, 0xffffffff)">Native</Strategy-Identifier> | |||||
<Algorithm-Identifier class-id="(0x2ba17a3c, 0x1bd46d84)">Linear Discrimimant Analysis (LDA)</Algorithm-Identifier> | |||||
<Stimulations> | |||||
<Class-Stimulation class-id="0">OVTK_StimulationId_Target</Class-Stimulation> | |||||
<Class-Stimulation class-id="1">OVTK_StimulationId_NonTarget</Class-Stimulation> | |||||
</Stimulations> | |||||
<OpenViBE-Classifier> | |||||
<LDA version="1"> | |||||
<Classes>0 1 </Classes> | |||||
<Class-config-list> | |||||
<Class-config> | |||||
<Weights> -1.830140e+00 -2.186864e+00 3.559042e+01 -1.083778e+02 1.779947e+02 -1.877161e+02 1.385119e+02 -8.420175e+01 6.565683e+01 -8.468858e+01 1.225329e+02 -1.628122e+02 1.873070e+02 -1.725218e+02 1.064066e+02 -2.119184e+00 -1.170924e+02 2.253049e+02 -2.975638e+02 3.174168e+02 -2.802059e+02 1.991842e+02 -1.143956e+02 6.861966e+01 -7.352136e+01 1.201358e+02 -2.115440e+02 3.423738e+02 -4.713994e+02 5.599098e+02 -5.918283e+02 5.573591e+02 -4.748986e+02 3.928411e+02 -3.338092e+02 2.763467e+02 -1.819805e+02 4.964026e+01 6.383425e+01 -1.296463e+02 1.761420e+02 -1.990490e+02 1.657955e+02 -9.635469e+01 3.860637e+01 -9.250846e+00 -8.941531e+00 4.933733e+01 -1.377848e+02 2.583936e+02 -3.720801e+02 4.676306e+02 -5.462823e+02 5.843934e+02 -5.688947e+02 5.205689e+02 -4.545138e+02 3.830517e+02 -3.412220e+02 3.706566e+02 -4.747292e+02 6.069638e+02 -6.918061e+02 6.714276e+02 -5.485516e+02 3.807036e+02 -2.289429e+02 1.385710e+02 -1.302142e+02 1.889379e+02 -2.795823e+02 3.512672e+02 -3.391574e+02 2.147787e+02 -2.539907e+01 -1.464064e+02 2.354832e+02 -2.238563e+02 1.487121e+02 -5.782119e+01 -4.471280e+01 1.479935e+02 -2.058389e+02 2.258281e+02 -2.654091e+02 3.143095e+02 -3.350687e+02 3.463940e+02 -3.618979e+02 3.597727e+02 -3.615601e+02 4.065643e+02 -4.638968e+02 4.699463e+02 -4.079192e+02 2.899650e+02 -1.451548e+02 2.259753e+01 5.223942e+01 -8.874236e+01 8.798560e+01 -4.572111e+01 -3.348461e+01 1.533107e+02 -3.011877e+02 4.287501e+02 -5.100423e+02 5.586754e+02 -5.752231e+02 5.528098e+02 -5.032219e+02 4.245067e+02 -2.889144e+02 1.148274e+02 1.406780e+01 -4.648784e+01 6.176074e+00 6.106874e+01 -1.048837e+02 8.158174e+01 -3.405554e+00 -7.658673e+01 1.105747e+02 -8.041239e+01 4.297435e+01 -8.912910e+01 2.167005e+02 -3.445478e+02 4.125452e+02 -4.061561e+02 3.636666e+02 -3.565763e+02 4.068219e+02 -4.857160e+02 6.000355e+02 -7.763236e+02 9.745301e+02 -1.125320e+03 1.224077e+03 -1.299135e+03 1.348637e+03 -1.348061e+03 1.265651e+03 -1.100116e+03 9.141818e+02 -7.475428e+02 5.671345e+02 -3.661131e+02 1.936855e+02 -7.821941e+01 1.536146e+01 4.636106e+00 -2.957974e+00 1.176650e+01 -4.865394e+01 1.092504e+02 -1.915232e+02 2.841306e+02 -3.438041e+02 3.459385e+02 -3.209738e+02 3.079781e+02 -3.151088e+02 3.334223e+02 -3.572123e+02 3.840953e+02 -4.058616e+02 4.152607e+02 -4.074100e+02 3.766550e+02 -3.314412e+02 2.916418e+02 -2.649860e+02 2.523269e+02 -2.571428e+02 2.665677e+02 -2.548424e+02 2.234944e+02 -1.976423e+02 1.809444e+02 -1.624206e+02 1.386467e+02 -1.048243e+02 6.602562e+01 -4.967064e+01 6.292911e+01 -7.354625e+01 5.684196e+01 -2.554078e+01 4.098041e+00 1.287354e+00 -9.237039e+00 3.940817e+01 -8.211354e+01 1.110043e+02 -1.212343e+02 1.234918e+02 -1.109080e+02 7.239587e+01 -2.018430e+01 -2.471812e+01 5.103851e+01 -4.838445e+01 8.899843e+00 6.129881e+01 -1.427204e+02 2.025250e+02 -2.100583e+02 1.683798e+02 -1.131757e+02 7.469127e+01 -6.227470e+01 8.097558e+01 -1.313716e+02 1.958705e+02 -2.485736e+02 2.683634e+02 -2.497521e+02 2.083994e+02 -1.598574e+02 1.095573e+02 -6.739733e+01 4.585975e+01 -4.629460e+01 5.696731e+01 -5.782230e+01 3.725539e+01 -7.700068e+00 -5.121030e-01 -2.195645e+01 4.668608e+01 -4.637548e+01 3.180848e+01 -2.405608e+01 1.273498e+01 2.896915e+01 -1.002374e+02 1.790772e+02 -2.501405e+02 3.055153e+02 -3.448122e+02 3.846456e+02 -4.393110e+02 4.972880e+02 -5.370154e+02 5.470674e+02 -5.273175e+02 4.894149e+02 -4.462485e+02 3.985050e+02 -3.463797e+02 2.921162e+02 -2.308170e+02 1.674012e+02 -1.157445e+02 6.812900e+01 -1.073800e+01 -4.963513e+01 1.059545e+02 -1.656496e+02 2.285014e+02 -2.879856e+02 3.524818e+02 -4.296551e+02 4.997432e+02 -5.387875e+02 5.471678e+02 -5.421331e+02 5.420063e+02 -5.503932e+02 5.528575e+02 -5.431835e+02 5.374984e+02 -5.444704e+02 5.448911e+02 -5.195919e+02 4.700564e+02 -3.991924e+02 3.100860e+02 -2.172494e+02 1.359941e+02 -7.811977e+01 5.792751e+01 -7.164801e+01 9.365871e+01 -1.157249e+02 1.348987e+02 -1.203844e+02 5.636705e+01 2.529228e+01 -8.719409e+01 1.232397e+02 -1.546032e+02 1.989040e+02 -2.468338e+02 2.755259e+02 -2.744386e+02 2.499316e+02 -2.099780e+02 1.604033e+02 -1.160547e+02 9.003275e+01 -6.976496e+01 4.133227e+01 -1.523675e+01 2.955377e+00</Weights> | |||||
<Bias>-6.70807</Bias> | |||||
</Class-config> | |||||
<Class-config> | |||||
<Weights> -3.300492e+00 9.047789e+00 9.660379e-01 -4.168157e+01 8.149732e+01 -7.730307e+01 3.573252e+01 1.068012e+01 -4.923332e+01 7.739045e+01 -8.131484e+01 4.206167e+01 2.814139e+01 -8.184615e+01 8.358782e+01 -4.727826e+01 1.650903e+01 -2.373065e+01 7.667637e+01 -1.737397e+02 2.994470e+02 -4.171609e+02 4.917616e+02 -5.065267e+02 4.597470e+02 -3.770293e+02 2.948227e+02 -2.167504e+02 1.324938e+02 -4.722370e+01 -3.214024e+01 9.084687e+01 -1.039026e+02 7.984009e+01 -5.610528e+01 3.796899e+01 7.755136e+00 -7.850824e+01 1.240203e+02 -1.243726e+02 9.794071e+01 -4.895834e+01 -1.768238e+01 7.982394e+01 -1.279154e+02 1.633579e+02 -1.848739e+02 1.965080e+02 -2.006461e+02 1.899877e+02 -1.709042e+02 1.652304e+02 -1.728678e+02 1.667014e+02 -1.242014e+02 3.869136e+01 7.375498e+01 -1.731184e+02 2.326627e+02 -2.361384e+02 1.554789e+02 -6.252668e+00 -1.161729e+02 1.277323e+02 -3.192123e+01 -1.112713e+02 2.320535e+02 -2.778920e+02 2.440705e+02 -1.569221e+02 4.341489e+01 4.264611e+01 -3.198404e+01 -9.016570e+01 2.748641e+02 -4.511441e+02 5.454885e+02 -5.304076e+02 4.505714e+02 -3.418227e+02 1.878279e+02 -1.821503e+01 -7.898450e+01 9.458977e+01 -9.449511e+01 9.961228e+01 -1.077309e+02 1.295315e+02 -1.385108e+02 1.040606e+02 -5.872584e+01 4.060472e+01 -4.560894e+01 6.345540e+01 -7.920591e+01 6.008645e+01 -7.975075e+00 -4.174837e+01 8.162908e+01 -1.230707e+02 1.577769e+02 -1.718565e+02 1.428358e+02 -3.777761e+01 -1.258771e+02 2.843021e+02 -4.164094e+02 5.412298e+02 -6.441238e+02 7.000618e+02 -7.088667e+02 6.529235e+02 -4.962395e+02 2.582456e+02 -1.986528e+01 -1.493877e+02 2.270466e+02 -2.243577e+02 1.828705e+02 -1.556069e+02 1.647815e+02 -1.893008e+02 1.726799e+02 -7.780183e+01 -3.682756e+01 8.298000e+01 -6.009896e+01 1.628443e+01 1.616057e+01 -1.654537e+01 2.681751e+00 -3.013689e+01 1.175777e+02 -2.410939e+02 4.009464e+02 -6.021877e+02 7.940108e+02 -9.207602e+02 9.975585e+02 -1.062530e+03 1.117375e+03 -1.136571e+03 1.091906e+03 -9.854293e+02 8.624090e+02 -7.397312e+02 5.819760e+02 -3.836051e+02 1.886035e+02 -3.646406e+01 -4.316460e+01 4.363856e+01 -1.381231e+01 8.972500e+00 -3.565711e+01 7.994290e+01 -1.472081e+02 2.358694e+02 -3.133889e+02 3.519482e+02 -3.605861e+02 3.617763e+02 -3.613796e+02 3.585451e+02 -3.658775e+02 3.977957e+02 -4.450869e+02 4.823322e+02 -4.929867e+02 4.779222e+02 -4.502552e+02 4.306704e+02 -4.335729e+02 4.567582e+02 -4.890940e+02 5.130916e+02 -5.077587e+02 4.739175e+02 -4.365848e+02 4.079172e+02 -3.791679e+02 3.423428e+02 -2.941472e+02 2.349854e+02 -1.833759e+02 1.595513e+02 -1.536411e+02 1.399507e+02 -1.128808e+02 8.074479e+01 -4.167168e+01 -1.478228e+01 9.058015e+01 -1.666992e+02 2.120412e+02 -2.164009e+02 1.982747e+02 -1.708602e+02 1.336511e+02 -9.299276e+01 5.787427e+01 -2.478819e+01 -3.135366e+00 3.992475e+00 3.142701e+01 -8.524210e+01 1.344426e+02 -1.610580e+02 1.533396e+02 -1.205797e+02 8.797869e+01 -7.059336e+01 7.254766e+01 -9.882418e+01 1.419044e+02 -1.768973e+02 1.792466e+02 -1.422878e+02 8.333210e+01 -2.668074e+01 -1.952931e+01 5.465116e+01 -6.866593e+01 5.831351e+01 -4.387906e+01 4.851128e+01 -7.152828e+01 9.373663e+01 -9.397417e+01 6.764918e+01 -3.458923e+01 1.636260e+01 -5.099979e+00 -1.786702e+01 3.861660e+01 -2.459137e+01 -2.621881e+01 8.870011e+01 -1.365578e+02 1.509674e+02 -1.353674e+02 1.253753e+02 -1.517742e+02 2.081868e+02 -2.709016e+02 3.170232e+02 -3.290250e+02 3.086060e+02 -2.657746e+02 2.070394e+02 -1.529014e+02 1.242338e+02 -1.137023e+02 1.117516e+02 -1.213795e+02 1.260290e+02 -1.020153e+02 5.631579e+01 -5.608823e+00 -5.381425e+01 1.225985e+02 -1.864982e+02 2.440058e+02 -3.033862e+02 3.508386e+02 -3.649628e+02 3.470436e+02 -3.182371e+02 3.031887e+02 -3.084839e+02 3.224889e+02 -3.455391e+02 3.890489e+02 -4.454387e+02 4.944255e+02 -5.293752e+02 5.498786e+02 -5.461146e+02 5.163812e+02 -4.713428e+02 4.127281e+02 -3.416811e+02 2.781548e+02 -2.396423e+02 2.199857e+02 -2.074922e+02 1.917485e+02 -1.565835e+02 9.895700e+01 -4.195867e+01 7.635617e+00 7.836603e+00 -2.716915e+01 6.333918e+01 -1.019424e+02 1.226757e+02 -1.288269e+02 1.308046e+02 -1.185193e+02 8.224168e+01 -3.838160e+01 8.950628e+00 5.897934e+00 -1.144448e+01 7.601596e+00 -1.542633e+00</Weights> | |||||
<Bias>-2.46852</Bias> | |||||
</Class-config> | |||||
</Class-config-list> | |||||
</LDA> | |||||
</OpenViBE-Classifier> | |||||
</OpenViBE-Classifier-Box> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>Epoch block average</SettingValue> | |||||
<SettingValue>1</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>2</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue> | |||||
<SettingValue>${Player_ScenarioDirectory}/cfg/p300-spatial-filter.cfg</SettingValue> | |||||
<SettingValue>2</SettingValue> | |||||
<SettingValue>true</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>${Player_ScenarioDirectory}/scripts/p300-speller-stimulator.lua</SettingValue> | |||||
<SettingValue>OVTK_StimulationId_Label_01</SettingValue> | |||||
<SettingValue>OVTK_StimulationId_Label_07</SettingValue> | |||||
<SettingValue>6</SettingValue> | |||||
<SettingValue>6</SettingValue> | |||||
<SettingValue>6</SettingValue> | |||||
<SettingValue>0.2</SettingValue> | |||||
<SettingValue>0.1</SettingValue> | |||||
<SettingValue>1.0</SettingValue> | |||||
<SettingValue>3.0</SettingValue> | |||||
<SettingValue>OVTK_StimulationId_Label_00</SettingValue> | |||||
<SettingValue></SettingValue> | |||||
<SettingValue>20</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>${Path_Data}/plugins/simple-visualization/p300-speller.ui</SettingValue> | |||||
<SettingValue>OVTK_StimulationId_Label_01</SettingValue> | |||||
<SettingValue>OVTK_StimulationId_Label_07</SettingValue> | |||||
<SettingValue>5,5,5</SettingValue> | |||||
<SettingValue>100,100,100</SettingValue> | |||||
<SettingValue>60</SettingValue> | |||||
<SettingValue>0,0,0</SettingValue> | |||||
<SettingValue>25,25,25</SettingValue> | |||||
<SettingValue>40</SettingValue> | |||||
<SettingValue>20,20,70</SettingValue> | |||||
<SettingValue>10,10,30</SettingValue> | |||||
<SettingValue>40</SettingValue> | |||||
<SettingValue>10,40,10</SettingValue> | |||||
<SettingValue>60,100,60</SettingValue> | |||||
<SettingValue>40</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>${Player_ScenarioDirectory}/signals/p300-xdawn-train.ov</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
<OpenViBE-SettingsOverride> | |||||
<SettingValue>${Player_ScenarioDirectory}/signals/p300-xdawn-train.ov</SettingValue> | |||||
<SettingValue>false</SettingValue> | |||||
</OpenViBE-SettingsOverride> |
Return 0x00008100 | |||||
<OpenViBE-Scenario> | |||||
<FormatVersion>2</FormatVersion> | |||||
<Creator>OpenViBE Designer</Creator> | |||||
<CreatorVersion>3.1.0</CreatorVersion> | |||||
<Settings></Settings> | |||||
<Inputs></Inputs> | |||||
<Outputs></Outputs> | |||||
<Boxes> | |||||
<Box> | |||||
<Identifier>(0x000014bf, 0x000034db)</Identifier> | |||||
<Name>Identity</Name> | |||||
<AlgorithmClassIdentifier>(0x5dffe431, 0x35215c50)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input stream 1</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input stream 2</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Input stream 3</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Output stream 1</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Output stream 2</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Output stream 3</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x17ee7c08, 0x94c14893)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>384</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>928</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x30a4e5c9, 0x83502953)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0xa8ffe2a3, 0x27038f03)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xac367a9c, 0x2da95abe)</Identifier> | |||||
<Value>6</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xfba64161, 0x65304e21)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00003f1b, 0x00003c78)</Identifier> | |||||
<Name>Signal Decimation</Name> | |||||
<AlgorithmClassIdentifier>(0x012f4bea, 0x3be37c66)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input signal</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Output signal</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Decimation factor</Name> | |||||
<DefaultValue>8</DefaultValue> | |||||
<Value>4</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>320</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>800</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x5082af41, 0xd0fbf4cb)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/p300-signal-decimation.cfg</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x0000556f, 0x000055f8)</Identifier> | |||||
<Name>Temporal Filter</Name> | |||||
<AlgorithmClassIdentifier>(0xb4f9d042, 0x9d79f2e5)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input signal</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Filtered signal</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2f2c606c, 0x8512ed68)</TypeIdentifier> | |||||
<Name>Filter method</Name> | |||||
<DefaultValue>Butterworth</DefaultValue> | |||||
<Value>Butterworth</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0xfa20178e, 0x4cba62e9)</TypeIdentifier> | |||||
<Name>Filter type</Name> | |||||
<DefaultValue>Low pass</DefaultValue> | |||||
<Value>Band pass</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Filter order</Name> | |||||
<DefaultValue>4</DefaultValue> | |||||
<Value>4</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Low cut frequency (Hz)</Name> | |||||
<DefaultValue>29</DefaultValue> | |||||
<Value>1.000000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>High cut frequency (Hz)</Name> | |||||
<DefaultValue>40</DefaultValue> | |||||
<Value>20</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Pass band ripple (dB)</Name> | |||||
<DefaultValue>0.5</DefaultValue> | |||||
<Value>0.500000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>208</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>800</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x27a4ceec, 0x876d6384)</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00005c5c, 0x00007610)</Identifier> | |||||
<Name>Raw</Name> | |||||
<AlgorithmClassIdentifier>(0x0055be5f, 0x087bdd12)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Data</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> | |||||
<Name>Channel Units</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x5de046a6, 0x086340aa)</TypeIdentifier> | |||||
<Name>Display Mode</Name> | |||||
<DefaultValue>Scan</DefaultValue> | |||||
<Value>Scan</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x33a30739, 0x00d5299b)</TypeIdentifier> | |||||
<Name>Auto vertical scale</Name> | |||||
<DefaultValue>Per channel</DefaultValue> | |||||
<Value>Per channel</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Scale refresh interval (secs)</Name> | |||||
<DefaultValue>5</DefaultValue> | |||||
<Value>5</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Vertical Scale</Name> | |||||
<DefaultValue>100</DefaultValue> | |||||
<Value>100</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Vertical Offset</Name> | |||||
<DefaultValue>0</DefaultValue> | |||||
<Value>0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Time Scale</Name> | |||||
<DefaultValue>10</DefaultValue> | |||||
<Value>10</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Horizontal ruler</Name> | |||||
<DefaultValue>true</DefaultValue> | |||||
<Value>true</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Vertical ruler</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Multiview</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>512</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>1024</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x92c056a7, 0x2dc71aff)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> | |||||
<Value>false</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>9</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value>3</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00006b6d, 0x00002690)</Identifier> | |||||
<Name>Acquisition client</Name> | |||||
<AlgorithmClassIdentifier>(0x35d225cb, 0x3e6e3a5f)</AlgorithmClassIdentifier> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x403488e7, 0x565d70b6)</TypeIdentifier> | |||||
<Name>Experiment information</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Signal stream</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x013df452, 0xa3a8879a)</TypeIdentifier> | |||||
<Name>Channel localisation</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> | |||||
<Name>Channel units</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> | |||||
<Name>Acquisition server hostname</Name> | |||||
<DefaultValue>${AcquisitionServer_HostName}</DefaultValue> | |||||
<Value>${AcquisitionServer_HostName}</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Acquisition server port</Name> | |||||
<DefaultValue>1024</DefaultValue> | |||||
<Value>1024</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>128</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>928</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x0d4656c0, 0xc95b1fa8)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> | |||||
<Value>false</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>5</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>2</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00007e4e, 0x00006b7b)</Identifier> | |||||
<Name>Filtered</Name> | |||||
<AlgorithmClassIdentifier>(0x0055be5f, 0x087bdd12)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Data</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> | |||||
<Name>Channel Units</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x5de046a6, 0x086340aa)</TypeIdentifier> | |||||
<Name>Display Mode</Name> | |||||
<DefaultValue>Scan</DefaultValue> | |||||
<Value>Scan</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x33a30739, 0x00d5299b)</TypeIdentifier> | |||||
<Name>Auto vertical scale</Name> | |||||
<DefaultValue>Per channel</DefaultValue> | |||||
<Value>Per channel</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Scale refresh interval (secs)</Name> | |||||
<DefaultValue>5</DefaultValue> | |||||
<Value>5</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Vertical Scale</Name> | |||||
<DefaultValue>100</DefaultValue> | |||||
<Value>100</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Vertical Offset</Name> | |||||
<DefaultValue>0</DefaultValue> | |||||
<Value>0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Time Scale</Name> | |||||
<DefaultValue>10</DefaultValue> | |||||
<Value>10</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Horizontal ruler</Name> | |||||
<DefaultValue>true</DefaultValue> | |||||
<Value>true</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Vertical ruler</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Multiview</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>512</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>832</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x92c056a7, 0x2dc71aff)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> | |||||
<Value>false</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>9</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value>3</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
</Boxes> | |||||
<Links> | |||||
<Link> | |||||
<Identifier>(0x000003a7, 0x000034db)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00005c5c, 0x00007610)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00000554, 0x0000661a)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00007e4e, 0x00006b7b)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00001d33, 0x00002bb0)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00006b6d, 0x00002690)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxInputIndex>2</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00003f04, 0x000045c3)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxOutputIndex>1</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00005c5c, 0x00007610)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00004b11, 0x00006a43)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00003f1b, 0x00003c78)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000056fd, 0x00004795)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00007e4e, 0x00006b7b)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00005703, 0x00006037)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000556f, 0x000055f8)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00003f1b, 0x00003c78)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00005e38, 0x00005c99)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00006b6d, 0x00002690)</BoxIdentifier> | |||||
<BoxOutputIndex>1</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x000014bf, 0x000034db)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000073ac, 0x0000581b)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00006b6d, 0x00002690)</BoxIdentifier> | |||||
<BoxOutputIndex>1</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000556f, 0x000055f8)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
</Links> | |||||
<Comments> | |||||
<Comment> | |||||
<Identifier>(0x00001653, 0x00002964)</Identifier> | |||||
<Text><u><b>Note:</b></u> be sure that the | |||||
<i>sampling rate</i> and <i>sample count | |||||
per buffer</i> you use in the <u>acquisition | |||||
server</u> are compatible with the actual | |||||
<i>signal decimation factor</i></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>512</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>416</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x000028e8, 0x00003dee)</Identifier> | |||||
<Text><u><b><big>Overview</big></b></u> | |||||
This scenario can be used in order | |||||
to check the quality of the signals | |||||
before starting an experiment. | |||||
One should <u>definitely</u> | |||||
check the quality of the signals | |||||
and ensure that : | |||||
- <b>eye blinks</b> are visible | |||||
- <b>jaw clenching</b> are visible | |||||
- <b>alpha waves</b> are visible when closing eyes</Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>1184</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>272</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x000049b3, 0x00001e28)</Identifier> | |||||
<Text>You can browse each box' documentation by selecting the box and pressing <b>F1</b></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>944</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>32</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x00004e8c, 0x000041b6)</Identifier> | |||||
<Text>The P300 XDawn scenarios are described in | |||||
http://openvibe.inria.fr/p300-speller-xdawn/</Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>576.000000</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>130.000000</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x000059b5, 0x00001524)</Identifier> | |||||
<Text>The <i>Temporal Filter</i> | |||||
and <i>Signal Decimation</i> | |||||
boxes transform the signal | |||||
so you can see what is actually | |||||
used online.</Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>512</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>288</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
</Comments> | |||||
<Metadata> | |||||
<Entry> | |||||
<Identifier>(0x0000775c, 0x000078ff)</Identifier> | |||||
<Type>(0x3bcce5d2, 0x43f2d968)</Type> | |||||
<Data>[{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":1,"height":635,"identifier":"(0x000077ee, 0x0000254d)","name":"default","parentIdentifier":"(0xffffffff, 0xffffffff)","type":1,"width":783},{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":1,"identifier":"(0x00004579, 0x00005fcb)","index":0,"name":"Default tab","parentIdentifier":"(0x000077ee, 0x0000254d)","type":2},{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":2,"dividerPosition":293,"identifier":"(0x00005446, 0x000043a1)","index":0,"maxDividerPosition":590,"name":"Vertical split","parentIdentifier":"(0x00004579, 0x00005fcb)","type":4},{"boxIdentifier":"(0x00005c5c, 0x00007610)","childCount":0,"identifier":"(0x00000e42, 0x000074b8)","index":0,"parentIdentifier":"(0x00005446, 0x000043a1)","type":3},{"boxIdentifier":"(0x00007e4e, 0x00006b7b)","childCount":0,"identifier":"(0x00005db7, 0x000032ad)","index":1,"parentIdentifier":"(0x00005446, 0x000043a1)","type":3}]</Data> | |||||
</Entry> | |||||
</Metadata> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x790d75b8, 0x3bb90c33)</Identifier> | |||||
<Value>Yann Renard</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8c1fc55b, 0x7b433dc2)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x9f5c4075, 0x4a0d3666)</Identifier> | |||||
<Value>Signal Monitoring</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf36a1567, 0xd13c53da)</Identifier> | |||||
<Value>http://openvibe.inria.fr/p300-speller-xdawn/</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf6b2e3fa, 0x7bd43926)</Identifier> | |||||
<Value>xDAWN P300 Speller</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf8034a49, 0x8b3f37cc)</Identifier> | |||||
<Value>INRIA</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</OpenViBE-Scenario> |
<OpenViBE-Scenario> | |||||
<FormatVersion>2</FormatVersion> | |||||
<Creator>OpenViBE Designer</Creator> | |||||
<CreatorVersion>3.1.0</CreatorVersion> | |||||
<Settings></Settings> | |||||
<Inputs></Inputs> | |||||
<Outputs></Outputs> | |||||
<Boxes> | |||||
<Box> | |||||
<Identifier>(0x00002ae2, 0x00004e06)</Identifier> | |||||
<Name>Keyboard stimulator</Name> | |||||
<AlgorithmClassIdentifier>(0x00d317b9, 0x6324c3ff)</AlgorithmClassIdentifier> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Outgoing Stimulations</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> | |||||
<Name>Filename</Name> | |||||
<DefaultValue>${Path_Data}/plugins/stimulation/simple-keyboard-to-stimulations.txt</DefaultValue> | |||||
<Value>${Player_ScenarioDirectory}/keyboard-to-stimulations.txt</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>16</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>608</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x8d89d3b7, 0x8339d210)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00002c69, 0x00000b43)</Identifier> | |||||
<Name>P300 Speller Visualization</Name> | |||||
<AlgorithmClassIdentifier>(0x195e41d6, 0x6e684d47)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Sequence stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Target stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Row selection stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Column selection stimulations</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Target / Non target flagging</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> | |||||
<Name>Interface filename</Name> | |||||
<DefaultValue>${Path_Data}/plugins/simple-visualization/p300-speller.glade</DefaultValue> | |||||
<Value>${Path_Data}/plugins/simple-visualization/p300-speller.ui</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Row stimulation base</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_01</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_01</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Column stimulation base</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_07</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_07</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>Flash background color</Name> | |||||
<DefaultValue>10,10,10</DefaultValue> | |||||
<Value>5,5,5</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>Flash foreground color</Name> | |||||
<DefaultValue>100,100,100</DefaultValue> | |||||
<Value>100,100,100</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Flash font size</Name> | |||||
<DefaultValue>100</DefaultValue> | |||||
<Value>60</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>No flash background color</Name> | |||||
<DefaultValue>0,0,0</DefaultValue> | |||||
<Value>0,0,0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>No flash foreground color</Name> | |||||
<DefaultValue>50,50,50</DefaultValue> | |||||
<Value>25,25,25</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>No flash font size</Name> | |||||
<DefaultValue>75</DefaultValue> | |||||
<Value>40</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>Target background color</Name> | |||||
<DefaultValue>10,40,10</DefaultValue> | |||||
<Value>20,20,70</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>Target foreground color</Name> | |||||
<DefaultValue>60,100,60</DefaultValue> | |||||
<Value>10,10,30</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Target font size</Name> | |||||
<DefaultValue>100</DefaultValue> | |||||
<Value>40</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>Selected background color</Name> | |||||
<DefaultValue>70,20,20</DefaultValue> | |||||
<Value>10,40,10</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x7f45a2a9, 0x7db12219)</TypeIdentifier> | |||||
<Name>Selected foreground color</Name> | |||||
<DefaultValue>30,10,10</DefaultValue> | |||||
<Value>60,100,60</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Selected font size</Name> | |||||
<DefaultValue>100</DefaultValue> | |||||
<Value>40</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>336</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>640</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x8d89d30c, 0xa939693a)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/p300-speller-visualization.cfg</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> | |||||
<Value>(0x00000000, 0x07e64d8b)</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x0000356c, 0x00004381)</Identifier> | |||||
<Name>Generic stream writer</Name> | |||||
<AlgorithmClassIdentifier>(0x09c92218, 0x7c1216f8)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x403488e7, 0x565d70b6)</TypeIdentifier> | |||||
<Name>Input stream 1</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input stream 2</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Input stream 3</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> | |||||
<Name>Filename</Name> | |||||
<DefaultValue></DefaultValue> | |||||
<Value>${Player_ScenarioDirectory}/signals/p300-xdawn-train.ov</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Use compression</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>544</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>624</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x89a08108, 0xc8d1fac1)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/stream-writer.cfg</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> | |||||
<Value>(0x00000000, 0x0350a9f0)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xfba64161, 0x65304e21)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x000043a8, 0x00004ec3)</Identifier> | |||||
<Name>Stimulation Filter</Name> | |||||
<AlgorithmClassIdentifier>(0x02f96101, 0x5e647cb8)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Modified Stimulations</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x09e59e57, 0x8d4a553a)</TypeIdentifier> | |||||
<Name>Default action</Name> | |||||
<DefaultValue>Reject</DefaultValue> | |||||
<Value>Reject</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Time range begin</Name> | |||||
<DefaultValue>0</DefaultValue> | |||||
<Value>0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Time range end</Name> | |||||
<DefaultValue>0</DefaultValue> | |||||
<Value>0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x09e59e57, 0x8d4a553a)</TypeIdentifier> | |||||
<Name>Action to perform</Name> | |||||
<DefaultValue>Select</DefaultValue> | |||||
<Value>Select</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Stimulation range begin</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_00</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Stimulation range end</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_0F</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_00</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>64</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>608</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x47859b3f, 0x1dfdf5cd)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x61d11811, 0x71e65362)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>6</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x0000470b, 0x00001b1d)</Identifier> | |||||
<Name>Speller Stimulator</Name> | |||||
<AlgorithmClassIdentifier>(0x0b5a2787, 0x02750621)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<Identifier>(0x00000000, 0x16595537)</Identifier> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>New input</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0xb0d0db45, 0x49cbc34a)</TypeIdentifier> | |||||
<Name>Lua Script</Name> | |||||
<DefaultValue></DefaultValue> | |||||
<Value>${Player_ScenarioDirectory}/scripts/p300-speller-stimulator.lua</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xbae13066)</Identifier> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Row Stimulation Base</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_01</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_01</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0x5518f982)</Identifier> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Column Stimulation Base</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_07</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_07</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xc152613d)</Identifier> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Matrix Size (m*m)</Name> | |||||
<DefaultValue>6</DefaultValue> | |||||
<Value>6</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xa0308929)</Identifier> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Number of Repetitions</Name> | |||||
<DefaultValue>6</DefaultValue> | |||||
<Value>3</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xcde95a6f)</Identifier> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Number of Trials</Name> | |||||
<DefaultValue>6</DefaultValue> | |||||
<Value>3</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0x9b3f9b7b)</Identifier> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Flash Duration (in sec)</Name> | |||||
<DefaultValue>0.2</DefaultValue> | |||||
<Value>0.2</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0x583ad367)</Identifier> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>No Flash Duration (in sec)</Name> | |||||
<DefaultValue>0.1</DefaultValue> | |||||
<Value>0.1</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xfc1c2fb6)</Identifier> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Inter-Repetition Delay (in sec)</Name> | |||||
<DefaultValue>1.0</DefaultValue> | |||||
<Value>1.0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0x0d9a1e18)</Identifier> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Inter-Trial Delay (in sec)</Name> | |||||
<DefaultValue>3.0</DefaultValue> | |||||
<Value>3.0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xaeefd500)</Identifier> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Start Stimulation</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_00</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0xef5eb0e5)</Identifier> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Free Spelling</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<Identifier>(0x00000000, 0x4ead155d)</Identifier> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Time To Send</Name> | |||||
<DefaultValue>20</DefaultValue> | |||||
<Value>20</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x17ee7c08, 0x94c14893)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>128</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>608</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0xd6e3f48b, 0xbee3523a)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x61d11811, 0x71e65362)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/p300-speller-stimulator.cfg</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf191c1c8, 0xa0123976)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xfba64161, 0x65304e21)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00004eca, 0x00003f33)</Identifier> | |||||
<Name>Player Controller</Name> | |||||
<AlgorithmClassIdentifier>(0x5f426dce, 0x08456e13)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Stimulation name</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> | |||||
<Value>OVTK_StimulationId_ExperimentStop</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0xcc14d8d6, 0xf27ecb73)</TypeIdentifier> | |||||
<Name>Action to perform</Name> | |||||
<DefaultValue>Pause</DefaultValue> | |||||
<Value>Stop</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>624</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>784</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x568d148e, 0x650792b3)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> | |||||
<Value>(0x00000000, 0x01070ba6)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> | |||||
<Value>false</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>2</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x0000599b, 0x000026ba)</Identifier> | |||||
<Name>Acquisition client</Name> | |||||
<AlgorithmClassIdentifier>(0x35d225cb, 0x3e6e3a5f)</AlgorithmClassIdentifier> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x403488e7, 0x565d70b6)</TypeIdentifier> | |||||
<Name>Experiment information</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Signal stream</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x013df452, 0xa3a8879a)</TypeIdentifier> | |||||
<Name>Channel localisation</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> | |||||
<Name>Channel units</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> | |||||
<Name>Acquisition server hostname</Name> | |||||
<DefaultValue>${AcquisitionServer_HostName}</DefaultValue> | |||||
<Value>${AcquisitionServer_HostName}</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Acquisition server port</Name> | |||||
<DefaultValue>1024</DefaultValue> | |||||
<Value>1024</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>464</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>688</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x0d4656c0, 0xc95b1fa8)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> | |||||
<Value>(0x00000000, 0x02909b75)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> | |||||
<Value>false</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>5</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>2</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00006d0d, 0x000031d8)</Identifier> | |||||
<Name>Target Letter Generation</Name> | |||||
<AlgorithmClassIdentifier>(0x0b5a2787, 0x02750621)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>New input</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0xb0d0db45, 0x49cbc34a)</TypeIdentifier> | |||||
<Name>Lua Script</Name> | |||||
<DefaultValue></DefaultValue> | |||||
<Value>${Player_ScenarioDirectory}/scripts/p300-speller-target.lua</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> | |||||
<Name>Word to Spell (leave this empty if random)</Name> | |||||
<DefaultValue></DefaultValue> | |||||
<Value></Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Row Stimulation Base</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_01</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_01</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Column Stimulation Base</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_07</DefaultValue> | |||||
<Value>OVTK_StimulationId_Label_07</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Delay Before Sending (in sec)</Name> | |||||
<DefaultValue>2</DefaultValue> | |||||
<Value>2</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x17ee7c08, 0x94c14893)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>256</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>736</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0xd6e3f48b, 0xbee3523a)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x61d11811, 0x71e65362)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> | |||||
<Value>(0x00000000, 0x0334c6b7)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf191c1c8, 0xa0123976)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xfba64161, 0x65304e21)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
</Boxes> | |||||
<Links> | |||||
<Link> | |||||
<Identifier>(0x00000ea4, 0x000068ff)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000599b, 0x000026ba)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00004eca, 0x00003f33)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000019a1, 0x00001d15)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000470b, 0x00001b1d)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00002c69, 0x00000b43)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00002128, 0x0000146c)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00002ae2, 0x00004e06)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x000043a8, 0x00004ec3)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000036a5, 0x00006190)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000599b, 0x000026ba)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000356c, 0x00004381)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00003aa4, 0x00002b37)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00006d0d, 0x000031d8)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00002c69, 0x00000b43)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x0000649d, 0x00004576)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000470b, 0x00001b1d)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00006d0d, 0x000031d8)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000068a0, 0x0000330f)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000599b, 0x000026ba)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000356c, 0x00004381)</BoxIdentifier> | |||||
<BoxInputIndex>2</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00007a3d, 0x000044a6)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x000043a8, 0x00004ec3)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000470b, 0x00001b1d)</BoxIdentifier> | |||||
<BoxInputIdentifier>(0x00000000, 0x16595537)</BoxInputIdentifier> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00007bda, 0x00000772)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000599b, 0x000026ba)</BoxIdentifier> | |||||
<BoxOutputIndex>1</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000356c, 0x00004381)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
</Links> | |||||
<Comments> | |||||
<Comment> | |||||
<Identifier>(0x0000363f, 0x00001c2b)</Identifier> | |||||
<Text>The P300 Speller Visualization | |||||
sends the markers (stimulations) directly to | |||||
Acquisition Server using TCP Tagging.</Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>960.000000</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>336.000000</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x00004e8c, 0x000041b6)</Identifier> | |||||
<Text>The P300 XDawn scenarios are described in | |||||
http://openvibe.inria.fr/p300-speller-xdawn/</Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>320.000000</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>176.000000</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x19b8795c, 0x039f26f7)</Identifier> | |||||
<Text><u><b><big>Overview</big></b></u> | |||||
This scenario can be used as a first | |||||
step to collect some training data. The | |||||
data will later be used to train a spatial | |||||
filter and a classifier for online use. | |||||
The flast sequence will start after 20 sec. | |||||
You will then be presented a blue letter that | |||||
you have to focus on, followed by a 12 times | |||||
flashing sequence of the whole grid. This will | |||||
be repeated 10 times. | |||||
<small><i><b>note:</b> the recorded files go to the | |||||
folder where the scenario xml is located | |||||
(<span color="darkblue">${Player_ScenarioDirectory}/</span>).</i></small></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>320.000000</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>400.000000</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x24020235, 0x4f7e23eb)</Identifier> | |||||
<Text>You can browse each box' documentation by selecting the box and pressing <b>F1</b></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>304</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>32</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
</Comments> | |||||
<Metadata> | |||||
<Entry> | |||||
<Identifier>(0x0000775c, 0x000078ff)</Identifier> | |||||
<Type>(0x3bcce5d2, 0x43f2d968)</Type> | |||||
<Data>[{"boxIdentifier":"(0x00002ae2, 0x00004e06)","childCount":0,"identifier":"(0x0000119f, 0x0000462a)","parentIdentifier":"(0xffffffff, 0xffffffff)","type":3},{"boxIdentifier":"(0x00002c69, 0x00000b43)","childCount":0,"identifier":"(0x0000742d, 0x000050d7)","parentIdentifier":"(0xffffffff, 0xffffffff)","type":3}]</Data> | |||||
</Entry> | |||||
</Metadata> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x790d75b8, 0x3bb90c33)</Identifier> | |||||
<Value>Yann Renard, Jussi T. Lindgren</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8c1fc55b, 0x7b433dc2)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x9f5c4075, 0x4a0d3666)</Identifier> | |||||
<Value>Data Acquisition</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf36a1567, 0xd13c53da)</Identifier> | |||||
<Value>http://openvibe.inria.fr/p300-speller-xdawn/</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf6b2e3fa, 0x7bd43926)</Identifier> | |||||
<Value>xDAWN P300 Speller</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf8034a49, 0x8b3f37cc)</Identifier> | |||||
<Value>INRIA</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</OpenViBE-Scenario> |
<OpenViBE-Scenario> | |||||
<FormatVersion>2</FormatVersion> | |||||
<Creator>OpenViBE Designer</Creator> | |||||
<CreatorVersion>3.1.0</CreatorVersion> | |||||
<Settings></Settings> | |||||
<Inputs></Inputs> | |||||
<Outputs></Outputs> | |||||
<Boxes> | |||||
<Box> | |||||
<Identifier>(0x00001db8, 0x00001848)</Identifier> | |||||
<Name>xDAWN Trainer</Name> | |||||
<AlgorithmClassIdentifier>(0x27542f6e, 0x14aa3548)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Session signal</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Evoked potential epochs</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Train-completed Flag</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Train stimulation</Name> | |||||
<DefaultValue>OVTK_StimulationId_Train</DefaultValue> | |||||
<Value>OVTK_StimulationId_ExperimentStop</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> | |||||
<Name>Spatial filter configuration</Name> | |||||
<DefaultValue></DefaultValue> | |||||
<Value>${Player_ScenarioDirectory}/p300-spatial-filter.cfg</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Filter dimension</Name> | |||||
<DefaultValue>4</DefaultValue> | |||||
<Value>3</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Save as box config</Name> | |||||
<DefaultValue>true</DefaultValue> | |||||
<Value>true</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>352</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>288</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x4b49a133, 0x42f38d94)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/p300-spatial-trainer.cfg</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00002514, 0x00001614)</Identifier> | |||||
<Name>Generic stream reader</Name> | |||||
<AlgorithmClassIdentifier>(0x6468099f, 0x0370095a)</AlgorithmClassIdentifier> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x403488e7, 0x565d70b6)</TypeIdentifier> | |||||
<Name>Output stream 1</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Output stream 2</Name> | |||||
</Output> | |||||
<Output> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Output stream 3</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> | |||||
<Name>Filename</Name> | |||||
<DefaultValue></DefaultValue> | |||||
<Value>${Player_ScenarioDirectory}/signals/p300-xdawn-train.ov</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x17ee7c08, 0x94c14893)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>-128</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>400</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x30a4e5c9, 0x83502953)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0xf37b8e7a, 0x1bc33e4e)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/stream-reader.cfg</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x0000267a, 0x0000427f)</Identifier> | |||||
<Name>Time based epoching</Name> | |||||
<AlgorithmClassIdentifier>(0x00777fa0, 0x5dc3f560)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input signal</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Epoched signal 1</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Epoch 1 duration (in sec)</Name> | |||||
<DefaultValue>1</DefaultValue> | |||||
<Value>0.250000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Epoch 1 intervals (in sec)</Name> | |||||
<DefaultValue>0.5</DefaultValue> | |||||
<Value>0.250000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x17ee7c08, 0x94c14893)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>160</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>240</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0xc5ff41e9, 0xccc59a01)</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00004aea, 0x00001465)</Identifier> | |||||
<Name>Player Controller</Name> | |||||
<AlgorithmClassIdentifier>(0x5f426dce, 0x08456e13)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Stimulation name</Name> | |||||
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> | |||||
<Value>OVTK_StimulationId_TrainCompleted</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0xcc14d8d6, 0xf27ecb73)</TypeIdentifier> | |||||
<Name>Action to perform</Name> | |||||
<DefaultValue>Pause</DefaultValue> | |||||
<Value>Stop</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>416</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>288</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x568d148e, 0x650792b3)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>2</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x0000556f, 0x000055f8)</Identifier> | |||||
<Name>Temporal Filter</Name> | |||||
<AlgorithmClassIdentifier>(0xb4f9d042, 0x9d79f2e5)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input signal</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Filtered signal</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2f2c606c, 0x8512ed68)</TypeIdentifier> | |||||
<Name>Filter method</Name> | |||||
<DefaultValue>Butterworth</DefaultValue> | |||||
<Value>Butterworth</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0xfa20178e, 0x4cba62e9)</TypeIdentifier> | |||||
<Name>Filter type</Name> | |||||
<DefaultValue>Low pass</DefaultValue> | |||||
<Value>Band pass</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Filter order</Name> | |||||
<DefaultValue>4</DefaultValue> | |||||
<Value>4</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Low cut frequency (Hz)</Name> | |||||
<DefaultValue>29</DefaultValue> | |||||
<Value>1.000000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>High cut frequency (Hz)</Name> | |||||
<DefaultValue>40</DefaultValue> | |||||
<Value>20</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Pass band ripple (dB)</Name> | |||||
<DefaultValue>0.5</DefaultValue> | |||||
<Value>0.500000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>-16</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>240</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x27a4ceec, 0x876d6384)</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00006be0, 0x000074b5)</Identifier> | |||||
<Name>Signal Decimation</Name> | |||||
<AlgorithmClassIdentifier>(0x012f4bea, 0x3be37c66)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input signal</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Output signal</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Decimation factor</Name> | |||||
<DefaultValue>8</DefaultValue> | |||||
<Value>4</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>112</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>240</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x5082af41, 0xd0fbf4cb)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8d21ff41, 0xdf6afe7e)</Identifier> | |||||
<Value>${Player_ScenarioDirectory}/cfg/p300-signal-decimation.cfg</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x00006fa4, 0x00003c76)</Identifier> | |||||
<Name>Target Selection</Name> | |||||
<AlgorithmClassIdentifier>(0x426163d1, 0x324237b0)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Input signal</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Input stimulations</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Epoched signal</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Epoch duration (in sec)</Name> | |||||
<DefaultValue>1</DefaultValue> | |||||
<Value>0.600000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Epoch offset (in sec)</Name> | |||||
<DefaultValue>0.5</DefaultValue> | |||||
<Value>0.000000</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> | |||||
<Name>Stimulation to epoch from</Name> | |||||
<DefaultValue>OVTK_GDF_VEP</DefaultValue> | |||||
<Value>OVTK_StimulationId_Target</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>250</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>425</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0xa79941ae, 0x80708445)</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
</Boxes> | |||||
<Links> | |||||
<Link> | |||||
<Identifier>(0x000002c2, 0x000038de)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000556f, 0x000055f8)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00006be0, 0x000074b5)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000007d3, 0x000071cb)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000267a, 0x0000427f)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00006fa4, 0x00003c76)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00003582, 0x00002c04)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00006be0, 0x000074b5)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000267a, 0x0000427f)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00003920, 0x00007a30)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x0000267a, 0x0000427f)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00001db8, 0x00001848)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x0000452e, 0x0000366d)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00002514, 0x00001614)</BoxIdentifier> | |||||
<BoxOutputIndex>1</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x0000556f, 0x000055f8)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00004be2, 0x00004296)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00006fa4, 0x00003c76)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00001db8, 0x00001848)</BoxIdentifier> | |||||
<BoxInputIndex>2</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00004bf5, 0x00007908)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00001db8, 0x00001848)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00004aea, 0x00001465)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x000059e8, 0x00000032)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00002514, 0x00001614)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00001db8, 0x00001848)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
<Link> | |||||
<Identifier>(0x00006af9, 0x00002512)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x00002514, 0x00001614)</BoxIdentifier> | |||||
<BoxOutputIndex>2</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x00006fa4, 0x00003c76)</BoxIdentifier> | |||||
<BoxInputIndex>1</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
</Links> | |||||
<Comments> | |||||
<Comment> | |||||
<Identifier>(0x00000b43, 0x0000067f)</Identifier> | |||||
<Text>The preprocessing of the signal is | |||||
performed here... | |||||
<u><b>Note:</b></u> be sure that the | |||||
<i>sampling rate</i> and <i>sample count | |||||
per buffer</i> you use in the <u>acquisition | |||||
server</u> are compatible with the actual | |||||
<i>signal decimation factor</i></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>48</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>32</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x000010db, 0x00003fcd)</Identifier> | |||||
<Text>For prerecorded data to test this P300, see | |||||
<b>http://openvibe.inria.fr/datasets/</b> | |||||
</Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>752</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>192</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x000049d6, 0x00006e67)</Identifier> | |||||
<Text><u><b><big>Overview</big></b></u> | |||||
This scenario should be used to train | |||||
the spatial filter using the xDAWN algorithm. | |||||
Just configure the <i>Generic Stream Reader</i> | |||||
box to point to the last file you recorded with | |||||
scenario <i>1-acquisition</i> and fast forward | |||||
this scenario. | |||||
At the end of the training, you will have line in | |||||
the console about eigen values. | |||||
Using a <i>Player Controller</i> the scenario will | |||||
automatically pause at the end of the training. | |||||
If you want details on this values, you should read | |||||
<u>http://www.icp.inpg.fr/~rivetber/Publications/references/Rivet2009a.pdf</u></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>800.000000</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>-80.000000</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
<Comment> | |||||
<Identifier>(0x00007b93, 0x000041da)</Identifier> | |||||
<Text>You can browse each box' documentation by selecting the box and pressing <b>F1</b></Text> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> | |||||
<Value>304.000000</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> | |||||
<Value>-192.000000</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Comment> | |||||
</Comments> | |||||
<Metadata> | |||||
<Entry> | |||||
<Identifier>(0x0000775c, 0x000078ff)</Identifier> | |||||
<Type>(0x3bcce5d2, 0x43f2d968)</Type> | |||||
<Data>[]</Data> | |||||
</Entry> | |||||
</Metadata> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x790d75b8, 0x3bb90c33)</Identifier> | |||||
<Value>Yann Renard</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x8c1fc55b, 0x7b433dc2)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x9f5c4075, 0x4a0d3666)</Identifier> | |||||
<Value>Spatial Filter Training</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf36a1567, 0xd13c53da)</Identifier> | |||||
<Value>http://openvibe.inria.fr/p300-speller-xdawn/</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf6b2e3fa, 0x7bd43926)</Identifier> | |||||
<Value>xDAWN P300 Speller</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xf8034a49, 0x8b3f37cc)</Identifier> | |||||
<Value>INRIA</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</OpenViBE-Scenario> |
function arrayMax(a) | |||||
if #a == 0 then return nil, nil end | |||||
local maxIdx, maxValue = 0, a[0] | |||||
for i = 1, (#a -1 ) do | |||||
if maxValue < a[i] then | |||||
maxIdx, maxValue = i, a[i] | |||||
end | |||||
end | |||||
return maxIdx, maxValue | |||||
end | |||||
-- For handling target fifo | |||||
List = {} | |||||
function List.new () | |||||
return {first = 0, last = -1} | |||||
end | |||||
function List.pushright (list, value) | |||||
local last = list.last + 1 | |||||
list.last = last | |||||
list[last] = value | |||||
end | |||||
function List.popleft (list) | |||||
local first = list.first | |||||
if first > list.last then | |||||
error("list is empty") | |||||
end | |||||
local value = list[first] | |||||
list[first] = nil -- to allow garbage collection | |||||
list.first = first + 1 | |||||
return value | |||||
end | |||||
function List.isempty (list) | |||||
if list.first > list.last then | |||||
return true | |||||
else | |||||
return false | |||||
end | |||||
end | |||||
-- this function is called when the box is initialized | |||||
function initialize(box) | |||||
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua") | |||||
row_base = _G[box:get_setting(2)] | |||||
col_base = _G[box:get_setting(3)] | |||||
segment_start = _G[box:get_setting(4)] | |||||
segment_stop = _G[box:get_setting(5)] | |||||
-- 0 inactive, 1 segment started, 2 segment stopped (can vote) | |||||
segment_status = 0 | |||||
-- the idea is to push the flash states to the fifo, and when predictions arrive (with some delay), they are matched in oldest-first fashion. | |||||
target_fifo = List.new() | |||||
-- box:log("Info", string.format("pop %d %d", id[1], id[2])) | |||||
row_votes = {} | |||||
col_votes = {} | |||||
do_debug = false | |||||
end | |||||
-- this function is called when the box is uninitialized | |||||
function uninitialize(box) | |||||
end | |||||
function process(box) | |||||
-- loops until box is stopped | |||||
while box:keep_processing() do | |||||
-- first, parse the timeline stream | |||||
for stimulation = 1, box:get_stimulation_count(2) do | |||||
-- gets the received stimulation | |||||
local identifier, date, duration = box:get_stimulation(2, 1) | |||||
-- discards it | |||||
box:remove_stimulation(2, 1) | |||||
if identifier == segment_start then | |||||
if do_debug then | |||||
box:log("Info", string.format("Trial start")) | |||||
box:log("Info", string.format("Clear votes")) | |||||
end | |||||
-- zero the votes | |||||
col_votes = {} | |||||
row_votes = {} | |||||
target_fifo = List.new() | |||||
-- fixme fixed 20 | |||||
for i = 0,20 do | |||||
col_votes[i] = 0 | |||||
row_votes[i] = 0 | |||||
end | |||||
segment_status = 1 | |||||
end | |||||
-- Does the identifier code a flash? if so, put into fifo | |||||
if segment_status == 1 and identifier >= row_base and identifier <= OVTK_StimulationId_LabelEnd then | |||||
-- assume rows before cols | |||||
if identifier < col_base then | |||||
local t = {"row", identifier - row_base} | |||||
List.pushright(target_fifo,t) | |||||
if do_debug then | |||||
box:log("Info", string.format("Push row target %d", identifier - row_base )) | |||||
end | |||||
else | |||||
local t = {"col", identifier - col_base} | |||||
List.pushright(target_fifo,t) | |||||
if do_debug then | |||||
box:log("Info", string.format("Push col target %d", identifier - col_base )) | |||||
end | |||||
end | |||||
end | |||||
if identifier == segment_stop then | |||||
if do_debug then | |||||
box:log("Info", string.format("Trial stop")) | |||||
end | |||||
segment_status = 2 | |||||
end | |||||
end | |||||
-- then parse the classifications | |||||
for stimulation = 1, box:get_stimulation_count(1) do | |||||
-- gets the received stimulation | |||||
local identifier, date, duration = box:get_stimulation(1, 1) | |||||
-- discards it | |||||
box:remove_stimulation(1, 1) | |||||
-- Is it an in-class prediction? | |||||
if identifier == OVTK_StimulationId_Target then | |||||
local t = List.popleft(target_fifo) | |||||
if do_debug then | |||||
box:log("Info", string.format("Pred fifo %s %d is target", t[1], t[2])) | |||||
end | |||||
if t[1]=="row" then | |||||
row_votes[t[2]] = row_votes[t[2]] + 1 | |||||
else | |||||
col_votes[t[2]] = col_votes[t[2]] + 1 | |||||
end | |||||
end | |||||
if identifier == OVTK_StimulationId_NonTarget then | |||||
local t = List.popleft(target_fifo) | |||||
if do_debug then | |||||
box:log("Info", string.format("Pred fifo %s %d is nontarget", t[1], t[2])) | |||||
end | |||||
end | |||||
end | |||||
if segment_status == 2 and List.isempty(target_fifo) then | |||||
-- output the vote after the segment end when we've matched all predictions | |||||
local maxRowIdx, maxRowValue = arrayMax(row_votes) | |||||
local maxColIdx, maxColValue = arrayMax(col_votes) | |||||
if maxRowValue == 0 and maxColValue == 0 then | |||||
box:log("Warning", string.format("Classifier predicted 'no p300' for all flashes of the trial")); | |||||
end | |||||
if do_debug then | |||||
local rowVotes = 0 | |||||
local colVotes = 0 | |||||
for ir, val in pairs(row_votes) do | |||||
rowVotes = rowVotes + val | |||||
end | |||||
for ir, val in pairs(col_votes) do | |||||
colVotes = colVotes + val | |||||
end | |||||
box:log("Info", string.format("Vote [%d %d] wt [%d,%d]", maxRowIdx+row_base, maxColIdx+col_base, maxRowValue, maxColValue)) | |||||
box:log("Info", string.format(" Total [%d %d]", rowVotes, colVotes)) | |||||
end | |||||
local now = box:get_current_time() | |||||
box:send_stimulation(1, maxRowIdx + row_base, now, 0) | |||||
box:send_stimulation(2, maxColIdx + col_base, now, 0) | |||||
segment_status = 0 | |||||
end | |||||
box:sleep() | |||||
end | |||||
end | |||||
-- Picks out 'flashes' from a stimulation stream | |||||
-- this function is called when the box is initialized | |||||
function initialize(box) | |||||
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua") | |||||
box:set_filter_mode(1); | |||||
state = 0 | |||||
do_debug = false | |||||
end | |||||
-- this function is called when the box is uninitialized | |||||
function uninitialize(box) | |||||
end | |||||
-- this function is called once by the box | |||||
function process(box) | |||||
-- loop until box:keep_processing() returns zero | |||||
-- cpu will be released with a call to sleep | |||||
-- at the end of the loop | |||||
while box:keep_processing() do | |||||
-- gets current simulated time | |||||
t = box:get_current_time() | |||||
-- loops on every received stimulation for a given input | |||||
for stimulation = 1, box:get_stimulation_count(1) do | |||||
-- gets stimulation | |||||
stimulation_id, stimulation_time, stimulation_duration = box:get_stimulation(1, 1) | |||||
if stimulation_id == OVTK_StimulationId_SegmentStart then | |||||
state = 1 | |||||
elseif stimulation_id == OVTK_StimulationId_SegmentStop then | |||||
state = 0 | |||||
end | |||||
-- If we're between 'rest start' and 'rest_stop', this specifies a target | |||||
if state == 1 and stimulation_id >= OVTK_StimulationId_LabelStart and stimulation_id <= OVTK_StimulationId_LabelEnd then | |||||
box:send_stimulation(1, stimulation_id, stimulation_time, 0) | |||||
if do_debug then | |||||
box:log("Info", string.format("Push a target %d at %f (now %f)", stimulation_id, stimulation_time, t)) | |||||
end | |||||
end | |||||
-- discards it | |||||
box:remove_stimulation(1, 1) | |||||
end | |||||
-- releases cpu | |||||
box:sleep() | |||||
end | |||||
end |
-- Picks out 'targets' from a stimulation stream | |||||
-- this function is called when the box is initialized | |||||
function initialize(box) | |||||
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua") | |||||
state = 0 | |||||
box:set_filter_mode(1); | |||||
do_debug = false | |||||
end | |||||
-- this function is called when the box is uninitialized | |||||
function uninitialize(box) | |||||
end | |||||
-- this function is called once by the box | |||||
function process(box) | |||||
-- loop until box:keep_processing() returns zero | |||||
-- cpu will be released with a call to sleep | |||||
-- at the end of the loop | |||||
while box:keep_processing() do | |||||
-- gets current simulated time | |||||
t = box:get_current_time() | |||||
-- loops on every received stimulation for a given input | |||||
for stimulation = 1, box:get_stimulation_count(1) do | |||||
-- gets stimulation | |||||
stimulation_id, stimulation_time, stimulation_duration = box:get_stimulation(1, 1) | |||||
if stimulation_id == OVTK_StimulationId_RestStart then | |||||
state = 1 | |||||
elseif stimulation_id == OVTK_StimulationId_RestStop then | |||||
state = 0 | |||||
end | |||||
-- If we're between 'rest start' and 'rest_stop', this specifies a target | |||||
if state == 1 and stimulation_id >= OVTK_StimulationId_LabelStart and stimulation_id <= OVTK_StimulationId_LabelEnd then | |||||
box:send_stimulation(1, stimulation_id, stimulation_time, 0) | |||||
if do_debug then | |||||
box:log("Info", string.format("Push a target %d at %f (now = %f)", stimulation_id, stimulation_time, t)) | |||||
end | |||||
end | |||||
-- discards it | |||||
box:remove_stimulation(1, 1) | |||||
end | |||||
-- releases cpu | |||||
box:sleep() | |||||
end | |||||
end |
-- this function is called when the box is initialized | |||||
function initialize(box) | |||||
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua") | |||||
stim = _G[box:get_setting(2)] | |||||
launchTime = box:get_setting(3) | |||||
end | |||||
-- this function is called when the box is uninitialized | |||||
function uninitialize(box) | |||||
end | |||||
-- this function is called once by the box | |||||
function process(box) | |||||
box:send_stimulation(1, stim, launchTime, 0) | |||||
end |
-- This Lua script sends Stimulations to the speller visualization box for a p300-visual-speller | |||||
-- | |||||
-- Author : Tobias Baumann | |||||
-- Date : 2021-12-06 | |||||
-- Revised: 2021-21-07 | |||||
--This function lets the box sleep until a fixed moment | |||||
function wait_until(box, time) | |||||
while box:get_current_time() < time do | |||||
box:sleep() | |||||
end | |||||
end | |||||
--This function lets the box wait for a fixed duration | |||||
function wait_for(box, duration) | |||||
wait_until(box, box:get_current_time() + duration) | |||||
end | |||||
--this function checks, wether value already is an element of the given stim_matrix | |||||
function is_element(matrix, value) | |||||
for i = 1, #matrix do | |||||
if #matrix == 0 then | |||||
return(false) | |||||
elseif value == matrix[i] then | |||||
return(true) | |||||
end | |||||
end | |||||
return(false) | |||||
end | |||||
--this function creates a sequence of stimulations by shuffeling the values of the given stim_matrix | |||||
function create_sequence(matrix) | |||||
math.randomseed(os.time()) | |||||
local stim_matrix = {} | |||||
local stim_code = 0 | |||||
local i = 1 | |||||
while i <= #matrix do | |||||
stim_code = matrix[math.random(1,#matrix)] | |||||
if is_element(stim_matrix, stim_code) == false then | |||||
stim_matrix[i] = stim_code | |||||
i = i + 1 | |||||
end | |||||
end | |||||
return(stim_matrix) | |||||
end | |||||
-- this function is called when the box is initialized | |||||
function initialize(box) | |||||
--load stimulation codes | |||||
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua") | |||||
--load box settings | |||||
row_base = _G[box:get_setting(2)] | |||||
col_base = _G[box:get_setting(3)] | |||||
matrix_size = box:get_setting(4) | |||||
n_repetitions = box:get_setting(5) | |||||
flash_duration = box:get_setting(7) | |||||
noflash_duration = box:get_setting(8) | |||||
inter_repetition_delay = box:get_setting(9) | |||||
inter_trial_delay = box:get_setting(10) | |||||
send_toggle = _G[box:get_setting(11)] | |||||
time_to_send = box:get_setting(13) | |||||
if box:get_setting(12) == 'true' then | |||||
free_spelling = true | |||||
n_trials = 1 | |||||
else | |||||
free_spelling = false | |||||
n_trials = box:get_setting(6) | |||||
end | |||||
--Lua variables | |||||
send = false | |||||
row_stimcodes = {} | |||||
col_stimcodes = {} | |||||
for x = 1, matrix_size do | |||||
row_stimcodes[x] = row_base + x - 1 | |||||
end | |||||
for x = 1, matrix_size do | |||||
col_stimcodes[x] = col_base + x - 1 | |||||
end | |||||
end | |||||
-- this function is called when the box is uninitialized | |||||
function uninitialize(box) | |||||
end | |||||
-- this function is called once by the box | |||||
function process(box) | |||||
while box:keep_processing() do | |||||
if send then | |||||
for stimulation = 1, box:get_stimulation_count(1) do | |||||
stimulation_id, stimulation_time, stimulation_duration = box:get_stimulation(1, 1) | |||||
if stimulation_id == send_toggle then | |||||
send = false | |||||
box:send_stimulation(1, OVTK_StimulationId_ExperimentStop ,box:get_current_time() , 0) | |||||
box:remove_stimulation(1, 1) | |||||
end | |||||
end | |||||
for trial = 1, n_trials do | |||||
if not send then | |||||
break | |||||
end | |||||
box:send_stimulation(1, OVTK_StimulationId_RestStart, box:get_current_time() , 0) | |||||
wait_for(box, inter_trial_delay) | |||||
box:send_stimulation(1, OVTK_StimulationId_RestStop, box:get_current_time() , 0) | |||||
box:send_stimulation(1, OVTK_StimulationId_TrialStart ,box:get_current_time() , 0) | |||||
for segment = 1, n_repetitions do | |||||
row_stimcodes = create_sequence(row_stimcodes) | |||||
col_stimcodes = create_sequence(col_stimcodes) | |||||
box:send_stimulation(1, OVTK_StimulationId_SegmentStart ,box:get_current_time() , 0) | |||||
for i = 1, matrix_size do | |||||
box:send_stimulation(1, row_stimcodes[i] ,box:get_current_time() , 0) | |||||
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStart ,box:get_current_time() , 0) | |||||
wait_for(box, flash_duration) | |||||
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop ,box:get_current_time() , 0) | |||||
wait_for(box, noflash_duration) | |||||
box:send_stimulation(1, col_stimcodes[i] ,box:get_current_time() , 0) | |||||
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStart ,box:get_current_time() , 0) | |||||
wait_for(box, flash_duration) | |||||
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop ,box:get_current_time() , 0) | |||||
wait_for(box, noflash_duration) | |||||
end | |||||
box:send_stimulation(1, OVTK_StimulationId_SegmentStop ,box:get_current_time() , 0) | |||||
wait_for(box, inter_repetition_delay) | |||||
end | |||||
box:send_stimulation(1, OVTK_StimulationId_TrialStop ,box:get_current_time() , 0) | |||||
end | |||||
if not free_spelling then | |||||
box:send_stimulation(1, OVTK_StimulationId_ExperimentStop ,box:get_current_time() , 0) | |||||
send = false | |||||
end | |||||
else | |||||
for stimulation = 1, box:get_stimulation_count(1) do | |||||
stimulation_id, stimulation_time, stimulation_duration = box:get_stimulation(1, 1) | |||||
if stimulation_id == send_toggle then | |||||
send = true | |||||
wait_for(box, time_to_send) | |||||
box:send_stimulation(1, OVTK_StimulationId_ExperimentStart ,box:get_current_time() , 0) | |||||
box:remove_stimulation(1, 1) | |||||
end | |||||
end | |||||
end | |||||
-- releases cpu | |||||
box:sleep() | |||||
end | |||||
end |
-- This Lua script generates target stimulations for the P300 visualization | |||||
-- box based on the matrix of letters / numbers a P300 speller has | |||||
-- | |||||
-- Author : Yann Renard, INRIA | |||||
-- Date : 2011-03-15 | |||||
grid = | |||||
{ | |||||
{ 'a', 'b', 'c', 'd', 'e', 'f' }, | |||||
{ 'g', 'h', 'i', 'j', 'k', 'l' }, | |||||
{ 'm', 'n', 'o', 'p', 'q', 'r' }, | |||||
{ 's', 't', 'u', 'v', 'w', 'x' }, | |||||
{ 'y', 'z', '1', '2', '3', '4' }, | |||||
{ '5', '6', '7', '8', '9', '0' }, | |||||
} | |||||
index = 0 | |||||
function get_location(c) | |||||
for i = 1, 6 do | |||||
for j = 1, 6 do | |||||
if grid[i][j] == c then | |||||
return i, j | |||||
end | |||||
end | |||||
end | |||||
return 0, 0 | |||||
end | |||||
-- this function is called when the box is initialized | |||||
function initialize(box) | |||||
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua") | |||||
math.randomseed(os.time()) | |||||
target = box:get_setting(2) | |||||
row_base = _G[box:get_setting(3)] | |||||
col_base = _G[box:get_setting(4)] | |||||
delay = box:get_setting(5) | |||||
if target == "" then | |||||
for i = 1, 1000 do | |||||
a = math.random(1, #grid) | |||||
b = math.random(1, #grid[1]) | |||||
target = target .. grid[a][b] | |||||
end | |||||
end | |||||
end | |||||
-- this function is called when the box is uninitialized | |||||
function uninitialize(box) | |||||
end | |||||
-- this function is called once by the box | |||||
function process(box) | |||||
-- loop until box:keep_processing() returns zero | |||||
-- cpu will be released with a call to sleep | |||||
-- at the end of the loop | |||||
while box:keep_processing() do | |||||
-- gets current simulated time | |||||
t = box:get_current_time() | |||||
-- loops on every received stimulation for a given input | |||||
for stimulation = 1, box:get_stimulation_count(1) do | |||||
-- gets stimulation | |||||
stimulation_id, stimulation_time, stimulation_duration = box:get_stimulation(1, 1) | |||||
if stimulation_id == OVTK_StimulationId_RestStart then | |||||
-- finds a new target | |||||
index = index + 1 | |||||
r, c = get_location(string.sub(target, index, index)) | |||||
-- triggers the target | |||||
box:send_stimulation(1, row_base+r-1, t+delay, 0) | |||||
box:send_stimulation(1, col_base+c-1, t+delay, 0) | |||||
elseif stimulation_id == OVTK_StimulationId_ExperimentStop then | |||||
-- triggers train stimulation | |||||
box:send_stimulation(1, OVTK_StimulationId_Train, t+delay+1, 0) | |||||
end | |||||
-- discards it | |||||
box:remove_stimulation(1, 1) | |||||
end | |||||
-- releases cpu | |||||
box:sleep() | |||||
end | |||||
end |
The scenario will record its signals here. | |||||
<OpenViBE-Scenario> | |||||
<FormatVersion>2</FormatVersion> | |||||
<Creator>OpenViBE Designer</Creator> | |||||
<CreatorVersion>3.1.0</CreatorVersion> | |||||
<Settings></Settings> | |||||
<Inputs></Inputs> | |||||
<Outputs></Outputs> | |||||
<Boxes> | |||||
<Box> | |||||
<Identifier>(0x3e08c82e, 0x0d2d24a4)</Identifier> | |||||
<Name>Signal display</Name> | |||||
<AlgorithmClassIdentifier>(0x0055be5f, 0x087bdd12)</AlgorithmClassIdentifier> | |||||
<Inputs> | |||||
<Input> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Data</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> | |||||
<Name>Stimulations</Name> | |||||
</Input> | |||||
<Input> | |||||
<TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> | |||||
<Name>Channel Units</Name> | |||||
</Input> | |||||
</Inputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x5de046a6, 0x086340aa)</TypeIdentifier> | |||||
<Name>Display Mode</Name> | |||||
<DefaultValue>Scan</DefaultValue> | |||||
<Value>Scan</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x33a30739, 0x00d5299b)</TypeIdentifier> | |||||
<Name>Auto vertical scale</Name> | |||||
<DefaultValue>Per channel</DefaultValue> | |||||
<Value>Per channel</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Scale refresh interval (secs)</Name> | |||||
<DefaultValue>5</DefaultValue> | |||||
<Value>5</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Vertical Scale</Name> | |||||
<DefaultValue>100</DefaultValue> | |||||
<Value>100</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Vertical Offset</Name> | |||||
<DefaultValue>0</DefaultValue> | |||||
<Value>0</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> | |||||
<Name>Time Scale</Name> | |||||
<DefaultValue>10</DefaultValue> | |||||
<Value>10</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Bottom ruler</Name> | |||||
<DefaultValue>true</DefaultValue> | |||||
<Value>true</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Left ruler</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> | |||||
<Name>Multiview</Name> | |||||
<DefaultValue>false</DefaultValue> | |||||
<Value>false</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>192</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>304</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x92c056a7, 0x2dc71aff)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier> | |||||
<Value></Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>9</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> | |||||
<Value>3</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
<Box> | |||||
<Identifier>(0x7b2b7b39, 0x5af5da4c)</Identifier> | |||||
<Name>Sinus oscillator</Name> | |||||
<AlgorithmClassIdentifier>(0x7e33bdb8, 0x68194a4a)</AlgorithmClassIdentifier> | |||||
<Outputs> | |||||
<Output> | |||||
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> | |||||
<Name>Generated signal</Name> | |||||
</Output> | |||||
</Outputs> | |||||
<Settings> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Channel count</Name> | |||||
<DefaultValue>4</DefaultValue> | |||||
<Value>4</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Sampling frequency</Name> | |||||
<DefaultValue>512</DefaultValue> | |||||
<Value>512</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
<Setting> | |||||
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> | |||||
<Name>Generated epoch sample count</Name> | |||||
<DefaultValue>32</DefaultValue> | |||||
<Value>32</Value> | |||||
<Modifiability>false</Modifiability> | |||||
</Setting> | |||||
</Settings> | |||||
<Attributes> | |||||
<Attribute> | |||||
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> | |||||
<Value>96</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x207c9054, 0x3c841b63)</Identifier> | |||||
<Value>288</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier> | |||||
<Value>(0x0b214ed8, 0x1f9ad83a)</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier> | |||||
<Value>1</Value> | |||||
</Attribute> | |||||
<Attribute> | |||||
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier> | |||||
<Value>3</Value> | |||||
</Attribute> | |||||
</Attributes> | |||||
</Box> | |||||
</Boxes> | |||||
<Links> | |||||
<Link> | |||||
<Identifier>(0x70a72d33, 0x184ded92)</Identifier> | |||||
<Source> | |||||
<BoxIdentifier>(0x7b2b7b39, 0x5af5da4c)</BoxIdentifier> | |||||
<BoxOutputIndex>0</BoxOutputIndex> | |||||
</Source> | |||||
<Target> | |||||
<BoxIdentifier>(0x3e08c82e, 0x0d2d24a4)</BoxIdentifier> | |||||
<BoxInputIndex>0</BoxInputIndex> | |||||
</Target> | |||||
</Link> | |||||
</Links> | |||||
<Comments></Comments> | |||||
<Metadata> | |||||
<Entry> | |||||
<Identifier>(0x62d57af8, 0x33db2614)</Identifier> | |||||
<Type>(0x3bcce5d2, 0x43f2d968)</Type> | |||||
<Data>[{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":1,"height":320,"identifier":"(0x0e97678d, 0x6ef258bb)","name":"Default window","parentIdentifier":"(0xffffffff, 0xffffffff)","type":1,"width":480},{"boxIdentifier":"(0x3e08c82e, 0x0d2d24a4)","childCount":0,"identifier":"(0x7c573eef, 0x20de4327)","parentIdentifier":"(0xffffffff, 0xffffffff)","type":3},{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":1,"identifier":"(0x462bc06b, 0x0d9f0c93)","index":0,"name":"Default tab","parentIdentifier":"(0x0e97678d, 0x6ef258bb)","type":2},{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":0,"identifier":"(0x5328ab5c, 0x6312ede4)","index":0,"name":"Empty","parentIdentifier":"(0x462bc06b, 0x0d9f0c93)","type":0}]</Data> | |||||
</Entry> | |||||
</Metadata> | |||||
</OpenViBE-Scenario> |
from UIModell import * | |||||
from UIView import * | |||||
class Controller(): | |||||
def __init__(self, m, v): | |||||
self.model = m | |||||
self.view = v | |||||
def test(self): | |||||
self.model.trainXDawn() | |||||
def commandoCopySpelling(self): | |||||
self.model.startCopySpelling() | |||||
self.model.trainXDawn() | |||||
self.model.rainClassifier() | |||||
def commandFreeSpelling(self): | |||||
self.model.freeSpelling() | |||||
def commandStop(self): | |||||
self.model.killProzess() | |||||
from subprocess import * | |||||
import os | |||||
class Modell(): | |||||
PATH_OV = 'meta/dist/designer-Release/openvibe-designer.sh' | |||||
PATH_FILES = 'Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/' | |||||
def __init__(self): | |||||
pass | |||||
def startCopySpelling(self): | |||||
print("start copySpelling") | |||||
path = self.PATH_FILES + 'p300-visual-1-acquisition.xml' | |||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'], | |||||
stdout=PIPE, | |||||
universal_newlines=True) | |||||
while True: | |||||
output = process.stdout.readline() | |||||
print(output.strip()) | |||||
x = output.find("schlagwort?") | |||||
if(x != -1): | |||||
print("Training finished") | |||||
process.terminate() | |||||
break | |||||
self.killProzess() | |||||
def trainXDawn(self): | |||||
print("start training Xdawn") | |||||
path = self.PATH_FILES + 'p300-visual-2-train-xDAWN.xml' | |||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'], | |||||
stdout=PIPE, | |||||
universal_newlines=True) | |||||
while True: | |||||
output = process.stdout.readline() | |||||
print(output.strip()) | |||||
x = output.find("Training finished and saved") | |||||
if(x != -1): | |||||
print("Training finished") | |||||
process.terminate() | |||||
break | |||||
self.killProzess() | |||||
def trainClassifier(self): | |||||
print("start training Classifier") | |||||
path = self.PATH_FILES + 'p300-visual-3-train-classifier.xml' | |||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'], | |||||
stdout=PIPE, | |||||
universal_newlines=True) | |||||
while True: | |||||
output = process.stdout.readline() | |||||
print(output.strip()) | |||||
x = output.find("schlagwort?") | |||||
if(x != -1): | |||||
print("Training finished") | |||||
process.terminate() | |||||
break | |||||
self.killProzess() | |||||
def freeSpelling(self): | |||||
print("start freeSpelling") | |||||
path = self.PATH_FILES + 'p300-visual-4-online.xml' | |||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'], | |||||
stdout=PIPE, | |||||
universal_newlines=True) | |||||
while True: | |||||
output = process.stdout.readline() | |||||
print(output.strip()) | |||||
x = output.find("schlagwort?") | |||||
if(x != -1): | |||||
print("End Spelling") | |||||
process.terminate() | |||||
break | |||||
self.killProzess() | |||||
def killProzess(self): | |||||
print('start killing') | |||||
pidOV = 0 | |||||
pidP = 0 | |||||
items = [] | |||||
prozesse = Popen(["ps", "-e"], stdout=PIPE).communicate()[0].strip() | |||||
zeilen = prozesse.split('\n') | |||||
for z in zeilen: | |||||
if(z.find("openvibe-design") != -1): | |||||
z = z.strip() | |||||
items = z.split(' ') | |||||
pidOV = items[0] | |||||
#kill -TERM veranlasst dem Prozess sich selbst zu beenden (nicht erzwungen) | |||||
Popen(["kill", "-TERM", pidOV], stdout=PIPE).communicate() | |||||
print("killed openvibe-designer") |
class View(): | |||||
def __init__(self): | |||||
pass |
from UIView import * | |||||
from UIModell import * | |||||
from UIController import * | |||||
model = Modell() | |||||
view = View() | |||||
controller = Controller(model,view) | |||||
controller.test() |
Subproject commit d7602663166ba2397e4f9a8f3a74053e82937d86 |
local-tmp | |||||
dependencies | |||||
dependencies_x64 | |||||
scripts/win32-dependencies.cmd | |||||
dist | |||||
build | |||||
libraries/doc-tmp | |||||
CMakeLists.txt.* | |||||
CustomCMakeLists.txt | |||||
.*.swp | |||||
*~ | |||||
*.swp | |||||
# .build is generated on automated packaging on CI | |||||
.build | |||||
# this file can be copied from skeleton, and updated with appropriate credentials | |||||
scripts/windows-install-dependencies-custom.cmd | |||||
scripts/windows-install-dependencies-x64-custom.cmd | |||||
.version | |||||
# Temp & Software Folder | |||||
.vs/ | |||||
.vscode/ |
CMAKE_MINIMUM_REQUIRED(VERSION 3.4) | |||||
cmake_policy(SET CMP0026 OLD) | |||||
cmake_policy(SET CMP0039 NEW) | |||||
cmake_policy(SET CMP0042 OLD) | |||||
cmake_policy(SET CMP0043 OLD) | |||||
cmake_policy(SET CMP0045 OLD) | |||||
cmake_policy(SET CMP0048 OLD) | |||||
cmake_policy(SET CMP0057 NEW) | |||||
PROJECT(Designer) | |||||
SET(CMAKE_INSTALL_LIBDIR lib) # Fix for non debian-based distrib, as it seeems to be a common occurence to name this folder lib32/lib64 | |||||
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules") | |||||
# OpenViBE-specific helper functions that are used by the CMakeLists of the subprojects. | |||||
INCLUDE("OvAddProjects") | |||||
INCLUDE("OvInstallLaunchScript") | |||||
INCLUDE("OvLinkBoostLib") | |||||
INCLUDE("OvDelayLoad") | |||||
INCLUDE("SetProjectVersion") | |||||
INCLUDE("Utilities") # Include functions debug_message, SET_BUILD_PLATFORM | |||||
# ---------------------- | |||||
# Build CMake flags | |||||
# ---------------------- | |||||
OPTION(Flag_VerboseOutput "Verbose CMake output" OFF) | |||||
SET(OEM_DISTRIBUTION "openvibe" CACHE STRING "The OEM distribution for this build, can be openvibe or mensia") | |||||
OPTION(OV_DISPLAY_ERROR_LOCATION ON) | |||||
SET(OV_SOURCE_DEPENDENCIES_PATH "${CMAKE_SOURCE_DIR}/dependencies-source") | |||||
SET(OV_ICON_PATH "${CMAKE_SOURCE_DIR}/scripts/icons") | |||||
if(NOT(${Flag_VerboseOutput})) | |||||
set(CMAKE_INSTALL_MESSAGE LAZY) | |||||
endif() | |||||
IF(WIN32) | |||||
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") | |||||
SET(OV_DEPENDENCIES_PLATFORM_FOLDER_NAME "dependencies_x64") | |||||
ELSEIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") | |||||
SET(OV_DEPENDENCIES_PLATFORM_FOLDER_NAME "dependencies") | |||||
ELSE() | |||||
SET(OV_DEPENDENCIES_PLATFORM_FOLDER_NAME "dependencies") | |||||
ENDIF() | |||||
ELSE() | |||||
SET(OV_DEPENDENCIES_PLATFORM_FOLDER_NAME "dependencies") | |||||
ENDIF() | |||||
LIST(APPEND LIST_DEPENDENCIES_PATH "${CMAKE_SOURCE_DIR}/${OV_DEPENDENCIES_PLATFORM_FOLDER_NAME}") | |||||
# ---------------------- | |||||
# Set build version | |||||
# ---------------------- | |||||
# These versions are used by the subprojects by default. | |||||
set_version() | |||||
# Sets the PROJECT_VERSION variable to something, depending on overriding OvSetProjectVersion.cmake files | |||||
SET_PROJECT_VERSION() | |||||
MESSAGE(STATUS "BUILDING VERSION Designer: ${OV_GLOBAL_VERSION_STRING} Branch : ${OV_PROJECT_BRANCH}~${OV_PROJECT_COMMITHASH}. Based on OpenViBE SDK: ${OV_SDK_VERSION_STRING}") | |||||
# Sort target into directories for better visualization in IDE | |||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) | |||||
SET(APP_FOLDER Applications) | |||||
SET(MODULES_FOLDER Modules) | |||||
SET(PLUGINS_FOLDER Plugins) | |||||
SET(TESTS_FOLDER Unit-Tests) | |||||
SET(VALIDATION_FOLDER Validation-Tests) | |||||
IF(NOT CMAKE_INSTALL_PREFIX) | |||||
# Default is to build to dist/. If you wish a custom install, set your own MAKE_INSTALL_PREFIX when you call CMake. Safest to do under a fakeroot. | |||||
SET(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/dist") | |||||
ENDIF() | |||||
IF(NOT DEFINED OV_PACKAGE) | |||||
SET(OV_PACKAGE FALSE) | |||||
ENDIF() | |||||
# Setup knowledge of GNU-style install path variables | |||||
INCLUDE("GNUInstallDirs") | |||||
if(NOT CMAKE_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio*") | |||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin" ) | |||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib" ) | |||||
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) | |||||
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGU ) | |||||
string(CONCAT DIST_ROOT ${DIST_ROOT} $<$<CONFIG:${OUTPUTCONFIGU}>:${CMAKE_INSTALL_PREFIX}/${OUTPUTCONFIG}>) | |||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIGU} "${CMAKE_INSTALL_PREFIX}/${OUTPUTCONFIG}/bin" ) | |||||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIGU} "${CMAKE_INSTALL_PREFIX}/${OUTPUTCONFIG}/lib" ) | |||||
endforeach() | |||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "OV_CMAKE_PATH_ROOT=\"${DIST_ROOT}\"") | |||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "OV_CMAKE_PATH_BIN=\"${DIST_ROOT}/bin\"") | |||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "OV_CMAKE_PATH_LIB=\"${DIST_ROOT}/lib\"") | |||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "OV_CMAKE_PATH_DATA=\"${DIST_ROOT}/share/openvibe\"") | |||||
set(DIST_BINDIR ${DIST_ROOT}/bin) | |||||
set(DIST_LIBDIR ${DIST_ROOT}/lib) | |||||
set(DIST_INCLUDEDIR ${DIST_ROOT}/include) | |||||
set(DIST_DATADIR ${DIST_ROOT}/share) | |||||
set(DIST_DOCDIR ${DIST_ROOT}/doc) | |||||
set(DIST_DOCTMP ${DIST_ROOT}/doc-tmp) | |||||
set(DIST_SYSCONFDIR ${DIST_ROOT}/etc) | |||||
# Install the .install file inside the dists folders | |||||
install(FILES ${CMAKE_BINARY_DIR}/.install DESTINATION ${DIST_ROOT}) | |||||
elseif(CMAKE_BUILD_TYPE AND OV_PACKAGE) | |||||
# Add directories that OpenViBE will use to look for its components runtime, unless overridden by environment variables in the launch scripts. | |||||
# These defines should only be used in "openvibe/ov_directories.h". | |||||
add_definitions(-DOV_CMAKE_PATH_ROOT="${CMAKE_INSTALL_PREFIX}") | |||||
add_definitions(-DOV_CMAKE_PATH_BIN="${CMAKE_INSTALL_FULL_BINDIR}") | |||||
add_definitions(-DOV_CMAKE_PATH_LIB="${CMAKE_INSTALL_FULL_LIBDIR}") | |||||
add_definitions(-DOV_CMAKE_PATH_DATA="${CMAKE_INSTALL_FULL_DATADIR}/openvibe") | |||||
set(CMAKE_INSTALL_PREFIX .) | |||||
set(DIST_ROOT ${CMAKE_INSTALL_PREFIX}) | |||||
set(DIST_BINDIR ${CMAKE_INSTALL_BINDIR}) | |||||
set(DIST_LIBDIR ${CMAKE_INSTALL_LIBDIR}) | |||||
set(DIST_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) | |||||
set(DIST_DATADIR ${CMAKE_INSTALL_DATADIR}) | |||||
set(DIST_DOCDIR ${DIST_ROOT}/doc) | |||||
set(DIST_DOCTMP ${DIST_ROOT}/doc-tmp) | |||||
set(DIST_SYSCONFDIR ${CMAKE_INSTALL_SYSCONFDIR}) | |||||
set(CPACK_GENERATOR "ZIP") | |||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) | |||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenViBE Designer") | |||||
set(CPACK_PACKAGE_VENDOR "Inria & Mensia Technologies") | |||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") | |||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.md") | |||||
set(CPACK_PACKAGE_VERSION ${OV_GLOBAL_VERSION_MAJOR}.${OV_GLOBAL_VERSION_MINOR}.${OV_GLOBAL_VERSION_PATCH}.${OV_GLOBAL_VERSION_BUILD}) | |||||
set(CPACK_PACKAGE_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR}) | |||||
set(CPACK_PACKAGE_VERSION_MINOR ${OV_GLOBAL_VERSION_MINOR}) | |||||
set(CPACK_PACKAGE_VERSION_PATCH ${OV_GLOBAL_VERSION_PATCH}) | |||||
if(UNIX) | |||||
execute_process(COMMAND bash -c "echo -n $(lsb_release -i -s)$(lsb_release -r -s)" | |||||
OUTPUT_VARIABLE CPACK_SYSTEM_NAME) | |||||
endif() | |||||
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") | |||||
SET(PLATFORM_TARGET "x64") | |||||
ELSEIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") | |||||
SET(PLATFORM_TARGET "x86") | |||||
ELSE() | |||||
SET(PLATFORM_TARGET "Unknown") | |||||
ENDIF() | |||||
set(CPACK_PACKAGE_NAME "OpenViBE${CMAKE_PROJECT_NAME}-${CMAKE_BUILD_TYPE}-${PLATFORM_TARGET}") | |||||
include(CPack) | |||||
elseif(CMAKE_BUILD_TYPE) | |||||
# Add directories that OpenViBE will use to look for its components runtime, unless overridden by environment variables in the launch scripts. | |||||
# These defines should only be used in "openvibe/ov_directories.h". | |||||
add_definitions(-DOV_CMAKE_PATH_ROOT="${CMAKE_INSTALL_PREFIX}") | |||||
add_definitions(-DOV_CMAKE_PATH_BIN="${CMAKE_INSTALL_FULL_BINDIR}") | |||||
add_definitions(-DOV_CMAKE_PATH_LIB="${CMAKE_INSTALL_FULL_LIBDIR}") | |||||
add_definitions(-DOV_CMAKE_PATH_DATA="${CMAKE_INSTALL_FULL_DATADIR}/openvibe") | |||||
set(DIST_ROOT ${CMAKE_INSTALL_PREFIX}) | |||||
set(DIST_BINDIR ${CMAKE_INSTALL_FULL_BINDIR}) | |||||
set(DIST_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR}) | |||||
set(DIST_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR}) | |||||
set(DIST_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}) | |||||
set(DIST_DOCDIR ${DIST_ROOT}/doc) | |||||
set(DIST_DOCTMP ${DIST_ROOT}/doc-tmp) | |||||
set(DIST_SYSCONFDIR ${CMAKE_INSTALL_FULL_SYSCONFDIR}) | |||||
else() | |||||
message(FATAL_ERROR "Build should specify a type or use a multi-type generator (like Visual Studio)") | |||||
endif() | |||||
find_path(SDK_MODULE_PATH NAMES "AddOpenViBESDKComponents.cmake" PATHS ${OPENVIBE_SDK_PATH} PATH_SUFFIXES share NO_DEFAULT_PATH) # Finds multi-type builds | |||||
if(CMAKE_BUILD_TYPE) | |||||
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) | |||||
find_path(SDK_MODULE_PATH NAMES AddOpenViBESDKComponents.cmake PATHS ${OPENVIBE_SDK_PATH};${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES openvibe-sdk-${CMAKE_BUILD_TYPE_LOWER}/share NO_DEFAULT_PATH) # Find "regular builds | |||||
else() | |||||
find_path(SDK_MODULE_PATH NAMES "AddOpenViBESDKComponents.cmake" PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES openvibe-sdk-Debug/share openvibe-sdk-Release/share NO_DEFAULT_PATH) # Finds multi-type builds | |||||
endif() | |||||
if(SDK_MODULE_PATH) | |||||
LIST(APPEND CMAKE_MODULE_PATH ${SDK_MODULE_PATH}) | |||||
endif() | |||||
include(FindOVSDK) | |||||
# include(AddOpenViBESDKComponents) | |||||
# OpenViBE SDK modules list | |||||
SET(INCLUDED_OV_SDK_COMPONENTS BASE ALLPLUGINS EBML SYSTEM FS XML TOOLKIT) | |||||
string(TIMESTAMP COPYRIGHT_DATE "2012-%Y") | |||||
# We deduce the branding from the OEM_DISTRIBUTION | |||||
IF(OEM_DISTRIBUTION STREQUAL "openvibe") | |||||
SET(OV_CONFIG_SUBDIR "OpenVIBE" CACHE STRING "Subdirectory under user directory when configuration and logs will be saved") | |||||
SET(BRAND_NAME "OpenViBE") | |||||
SET(COMPANY_NAME "Inria") | |||||
SET(DESIGNER_NAME "Designer") | |||||
SET(LICENCE_TEXT "\ | |||||
This program is free software: you can redistribute it and/or modify\ | |||||
it under the terms of the GNU Affero General Public License as\ | |||||
published by the Free Software Foundation, either version 3 of the\ | |||||
License, or (at your option) any later version.\ | |||||
\ | |||||
This program is distributed in the hope that it will be useful, but\ | |||||
WITHOUT ANY WARRANTY; without even the implied warranty of\ | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\ | |||||
Affero General Public License for more details.\ | |||||
\ | |||||
You should have received a copy of the GNU Affero General Public\ | |||||
License along with this program. If not, see http://www.gnu.org/licenses/ .") | |||||
ELSEIF(OEM_DISTRIBUTION STREQUAL "mensia") | |||||
SET(OV_CONFIG_SUBDIR "mensia" CACHE STRING "Subdirectory under user directory when configuration and logs will be saved") | |||||
SET(BRAND_NAME "NeuroRT") | |||||
SET(DESIGNER_NAME "Studio") | |||||
SET(COMPANY_NAME "Mensia Technologies SA") | |||||
ADD_DEFINITIONS(-DMENSIA_DISTRIBUTION) | |||||
ELSE() | |||||
MESSAGE(FATAL_ERROR "OEM_DISTRIBUTION unrecognized (${OEM_DISTRIBUTION}) ! CMake cannot deduce the brand and product names. ") | |||||
ENDIF() | |||||
IF(OV_DISPLAY_ERROR_LOCATION) | |||||
ADD_DEFINITIONS(-DOV_DISPLAY_ERROR_LOCATION) | |||||
ENDIF() | |||||
# The user files will be stored in .../OV_CONFIG_SUBDIR folder | |||||
ADD_DEFINITIONS("-DOV_PROJECT_NAME=\"openvibe\"") | |||||
ADD_DEFINITIONS("-DOV_CONFIG_SUBDIR=\"${OV_CONFIG_SUBDIR}\"") | |||||
set(CMAKE_CXX_STANDARD 11) | |||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |||||
IF(WIN32) | |||||
ADD_DEFINITIONS("-DNOMINMAX -DBOOST_ALL_NO_LIB") | |||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4355") | |||||
SET(OV_WIN32_BOOST_VERSION "1_58") | |||||
ELSEIF(APPLE) | |||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") | |||||
ELSEIF(UNIX) | |||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") | |||||
FIND_PATH(PKGCONFIG_PATH lib/pkgconfig/atk.pc PATHS ${LIST_DEPENDENCIES_PATH}) | |||||
SET(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_PATH}/lib/pkgconfig") | |||||
ELSE(WIN32) | |||||
MESSAGE(WARNING "Warning: unknown platform") | |||||
ENDIF(WIN32) | |||||
# Print the used compilation parameters (for transparency) | |||||
GET_DIRECTORY_PROPERTY(TMP_DEFINITIONS COMPILE_DEFINITIONS) | |||||
debug_message("Compilation flags used at source root: ") | |||||
debug_message(" COMPILE_DEFINITIONS = '${TMP_DEFINITIONS}'") | |||||
debug_message(" CMAKE_CXX_FLAGS = '${CMAKE_CXX_FLAGS}'") | |||||
debug_message(" CMAKE_CXX_FLAGS_RELEASE = '${CMAKE_CXX_FLAGS_RELEASE}'") | |||||
debug_message(" CMAKE_CXX_FLAGS_DEBUG = '${CMAKE_CXX_FLAGS_DEBUG}'") | |||||
# if no specific branch has been given for an openvibe component, default is to compile its trunk folder | |||||
## SET(OV_TRUNK "trunc") | |||||
# By setting SKIP[_FOLDER]* you can skip a subtree (example: SKIP_A_B_C skips folder a/b/c and all its subfolders if any) | |||||
# Custom cmakelist can be used to overwrite the default compilation & packaging parameters | |||||
IF(EXISTS "${CMAKE_SOURCE_DIR}/CustomCMakeLists.txt") | |||||
debug_message("Found custom build settings") | |||||
INCLUDE("${CMAKE_SOURCE_DIR}/CustomCMakeLists.txt") | |||||
ENDIF() | |||||
################################################################# | |||||
string(TOLOWER ${BRAND_NAME} LOWER_BRAND_NAME) | |||||
string(TOLOWER ${DESIGNER_NAME} LOWER_DESIGNER_NAME) | |||||
ADD_DEFINITIONS(-DBRAND_NAME="${BRAND_NAME}") | |||||
ADD_DEFINITIONS(-DDESIGNER_NAME="${DESIGNER_NAME}") | |||||
################################################################# | |||||
SET(OV_LAUNCHER_SOURCE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules/launchers") | |||||
# a list of all project which will be filled by the directory traversal. This is needed to generate the documentation. | |||||
SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS "") | |||||
SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS_BUILD_DIR "") | |||||
# Used by the various Find* scripts to locate OpenViBE modules | |||||
SET(OV_BASE_DIR ${CMAKE_SOURCE_DIR}) | |||||
# needed for making visual studio projects when this script is called without CMAKE_BUILD_TYPE | |||||
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG "TARGET_BUILDTYPE_Debug") | |||||
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE "TARGET_BUILDTYPE_Release") | |||||
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO "TARGET_BUILDTYPE_Release") | |||||
MESSAGE(STATUS "Building ${BRAND_NAME} ${DESIGNER_NAME} [${OEM_DISTRIBUTION}] Version : ${PROJECT_VERSION} ${OV_PROJECT_BRANCH}~${OV_PROJECT_COMMITHASH}") | |||||
# Add vendor specific installation instructions | |||||
# Traverse these directories and build their components | |||||
ADD_SUBDIRECTORY("documentation/") | |||||
IF(NOT(SKIP_PLUGINS)) | |||||
ADD_SUBDIRECTORY("plugins/") | |||||
ENDIF() | |||||
IF(NOT(SKIP_APPLICATIONS)) | |||||
ADD_SUBDIRECTORY("applications/") | |||||
ENDIF() | |||||
IF(NOT(SKIP_LIBRARIES)) | |||||
ADD_SUBDIRECTORY("libraries/") | |||||
ENDIF() | |||||
IF(NOT(SKIP_VISUALIZATION_TOOLKIT)) | |||||
ADD_SUBDIRECTORY("visualization-toolkit/") | |||||
ENDIF() | |||||
# add the scripts to the project so IDEs using the CMake file are aware of them | |||||
FILE(GLOB_RECURSE script_files scripts/*.cmd scripts/*.sh ) | |||||
ADD_CUSTOM_TARGET(openvibe-scripts SOURCES ${script_files}) | |||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/.install" DESTINATION ${CMAKE_INSTALL_PREFIX}) |
GNU AFFERO GENERAL PUBLIC LICENSE | |||||
Version 3, 19 November 2007 | |||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |||||
Everyone is permitted to copy and distribute verbatim copies | |||||
of this license document, but changing it is not allowed. | |||||
Preamble | |||||
The GNU Affero General Public License is a free, copyleft license for | |||||
software and other kinds of works, specifically designed to ensure | |||||
cooperation with the community in the case of network server software. | |||||
The licenses for most software and other practical works are designed | |||||
to take away your freedom to share and change the works. By contrast, | |||||
our General Public Licenses are intended to guarantee your freedom to | |||||
share and change all versions of a program--to make sure it remains free | |||||
software for all its users. | |||||
When we speak of free software, we are referring to freedom, not | |||||
price. Our General Public Licenses are designed to make sure that you | |||||
have the freedom to distribute copies of free software (and charge for | |||||
them if you wish), that you receive source code or can get it if you | |||||
want it, that you can change the software or use pieces of it in new | |||||
free programs, and that you know you can do these things. | |||||
Developers that use our General Public Licenses protect your rights | |||||
with two steps: (1) assert copyright on the software, and (2) offer | |||||
you this License which gives you legal permission to copy, distribute | |||||
and/or modify the software. | |||||
A secondary benefit of defending all users' freedom is that | |||||
improvements made in alternate versions of the program, if they | |||||
receive widespread use, become available for other developers to | |||||
incorporate. Many developers of free software are heartened and | |||||
encouraged by the resulting cooperation. However, in the case of | |||||
software used on network servers, this result may fail to come about. | |||||
The GNU General Public License permits making a modified version and | |||||
letting the public access it on a server without ever releasing its | |||||
source code to the public. | |||||
The GNU Affero General Public License is designed specifically to | |||||
ensure that, in such cases, the modified source code becomes available | |||||
to the community. It requires the operator of a network server to | |||||
provide the source code of the modified version running there to the | |||||
users of that server. Therefore, public use of a modified version, on | |||||
a publicly accessible server, gives the public access to the source | |||||
code of the modified version. | |||||
An older license, called the Affero General Public License and | |||||
published by Affero, was designed to accomplish similar goals. This is | |||||
a different license, not a version of the Affero GPL, but Affero has | |||||
released a new version of the Affero GPL which permits relicensing under | |||||
this license. | |||||
The precise terms and conditions for copying, distribution and | |||||
modification follow. | |||||
TERMS AND CONDITIONS | |||||
0. Definitions. | |||||
"This License" refers to version 3 of the GNU Affero General Public License. | |||||
"Copyright" also means copyright-like laws that apply to other kinds of | |||||
works, such as semiconductor masks. | |||||
"The Program" refers to any copyrightable work licensed under this | |||||
License. Each licensee is addressed as "you". "Licensees" and | |||||
"recipients" may be individuals or organizations. | |||||
To "modify" a work means to copy from or adapt all or part of the work | |||||
in a fashion requiring copyright permission, other than the making of an | |||||
exact copy. The resulting work is called a "modified version" of the | |||||
earlier work or a work "based on" the earlier work. | |||||
A "covered work" means either the unmodified Program or a work based | |||||
on the Program. | |||||
To "propagate" a work means to do anything with it that, without | |||||
permission, would make you directly or secondarily liable for | |||||
infringement under applicable copyright law, except executing it on a | |||||
computer or modifying a private copy. Propagation includes copying, | |||||
distribution (with or without modification), making available to the | |||||
public, and in some countries other activities as well. | |||||
To "convey" a work means any kind of propagation that enables other | |||||
parties to make or receive copies. Mere interaction with a user through | |||||
a computer network, with no transfer of a copy, is not conveying. | |||||
An interactive user interface displays "Appropriate Legal Notices" | |||||
to the extent that it includes a convenient and prominently visible | |||||
feature that (1) displays an appropriate copyright notice, and (2) | |||||
tells the user that there is no warranty for the work (except to the | |||||
extent that warranties are provided), that licensees may convey the | |||||
work under this License, and how to view a copy of this License. If | |||||
the interface presents a list of user commands or options, such as a | |||||
menu, a prominent item in the list meets this criterion. | |||||
1. Source Code. | |||||
The "source code" for a work means the preferred form of the work | |||||
for making modifications to it. "Object code" means any non-source | |||||
form of a work. | |||||
A "Standard Interface" means an interface that either is an official | |||||
standard defined by a recognized standards body, or, in the case of | |||||
interfaces specified for a particular programming language, one that | |||||
is widely used among developers working in that language. | |||||
The "System Libraries" of an executable work include anything, other | |||||
than the work as a whole, that (a) is included in the normal form of | |||||
packaging a Major Component, but which is not part of that Major | |||||
Component, and (b) serves only to enable use of the work with that | |||||
Major Component, or to implement a Standard Interface for which an | |||||
implementation is available to the public in source code form. A | |||||
"Major Component", in this context, means a major essential component | |||||
(kernel, window system, and so on) of the specific operating system | |||||
(if any) on which the executable work runs, or a compiler used to | |||||
produce the work, or an object code interpreter used to run it. | |||||
The "Corresponding Source" for a work in object code form means all | |||||
the source code needed to generate, install, and (for an executable | |||||
work) run the object code and to modify the work, including scripts to | |||||
control those activities. However, it does not include the work's | |||||
System Libraries, or general-purpose tools or generally available free | |||||
programs which are used unmodified in performing those activities but | |||||
which are not part of the work. For example, Corresponding Source | |||||
includes interface definition files associated with source files for | |||||
the work, and the source code for shared libraries and dynamically | |||||
linked subprograms that the work is specifically designed to require, | |||||
such as by intimate data communication or control flow between those | |||||
subprograms and other parts of the work. | |||||
The Corresponding Source need not include anything that users | |||||
can regenerate automatically from other parts of the Corresponding | |||||
Source. | |||||
The Corresponding Source for a work in source code form is that | |||||
same work. | |||||
2. Basic Permissions. | |||||
All rights granted under this License are granted for the term of | |||||
copyright on the Program, and are irrevocable provided the stated | |||||
conditions are met. This License explicitly affirms your unlimited | |||||
permission to run the unmodified Program. The output from running a | |||||
covered work is covered by this License only if the output, given its | |||||
content, constitutes a covered work. This License acknowledges your | |||||
rights of fair use or other equivalent, as provided by copyright law. | |||||
You may make, run and propagate covered works that you do not | |||||
convey, without conditions so long as your license otherwise remains | |||||
in force. You may convey covered works to others for the sole purpose | |||||
of having them make modifications exclusively for you, or provide you | |||||
with facilities for running those works, provided that you comply with | |||||
the terms of this License in conveying all material for which you do | |||||
not control copyright. Those thus making or running the covered works | |||||
for you must do so exclusively on your behalf, under your direction | |||||
and control, on terms that prohibit them from making any copies of | |||||
your copyrighted material outside their relationship with you. | |||||
Conveying under any other circumstances is permitted solely under | |||||
the conditions stated below. Sublicensing is not allowed; section 10 | |||||
makes it unnecessary. | |||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |||||
No covered work shall be deemed part of an effective technological | |||||
measure under any applicable law fulfilling obligations under article | |||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or | |||||
similar laws prohibiting or restricting circumvention of such | |||||
measures. | |||||
When you convey a covered work, you waive any legal power to forbid | |||||
circumvention of technological measures to the extent such circumvention | |||||
is effected by exercising rights under this License with respect to | |||||
the covered work, and you disclaim any intention to limit operation or | |||||
modification of the work as a means of enforcing, against the work's | |||||
users, your or third parties' legal rights to forbid circumvention of | |||||
technological measures. | |||||
4. Conveying Verbatim Copies. | |||||
You may convey verbatim copies of the Program's source code as you | |||||
receive it, in any medium, provided that you conspicuously and | |||||
appropriately publish on each copy an appropriate copyright notice; | |||||
keep intact all notices stating that this License and any | |||||
non-permissive terms added in accord with section 7 apply to the code; | |||||
keep intact all notices of the absence of any warranty; and give all | |||||
recipients a copy of this License along with the Program. | |||||
You may charge any price or no price for each copy that you convey, | |||||
and you may offer support or warranty protection for a fee. | |||||
5. Conveying Modified Source Versions. | |||||
You may convey a work based on the Program, or the modifications to | |||||
produce it from the Program, in the form of source code under the | |||||
terms of section 4, provided that you also meet all of these conditions: | |||||
a) The work must carry prominent notices stating that you modified | |||||
it, and giving a relevant date. | |||||
b) The work must carry prominent notices stating that it is | |||||
released under this License and any conditions added under section | |||||
7. This requirement modifies the requirement in section 4 to | |||||
"keep intact all notices". | |||||
c) You must license the entire work, as a whole, under this | |||||
License to anyone who comes into possession of a copy. This | |||||
License will therefore apply, along with any applicable section 7 | |||||
additional terms, to the whole of the work, and all its parts, | |||||
regardless of how they are packaged. This License gives no | |||||
permission to license the work in any other way, but it does not | |||||
invalidate such permission if you have separately received it. | |||||
d) If the work has interactive user interfaces, each must display | |||||
Appropriate Legal Notices; however, if the Program has interactive | |||||
interfaces that do not display Appropriate Legal Notices, your | |||||
work need not make them do so. | |||||
A compilation of a covered work with other separate and independent | |||||
works, which are not by their nature extensions of the covered work, | |||||
and which are not combined with it such as to form a larger program, | |||||
in or on a volume of a storage or distribution medium, is called an | |||||
"aggregate" if the compilation and its resulting copyright are not | |||||
used to limit the access or legal rights of the compilation's users | |||||
beyond what the individual works permit. Inclusion of a covered work | |||||
in an aggregate does not cause this License to apply to the other | |||||
parts of the aggregate. | |||||
6. Conveying Non-Source Forms. | |||||
You may convey a covered work in object code form under the terms | |||||
of sections 4 and 5, provided that you also convey the | |||||
machine-readable Corresponding Source under the terms of this License, | |||||
in one of these ways: | |||||
a) Convey the object code in, or embodied in, a physical product | |||||
(including a physical distribution medium), accompanied by the | |||||
Corresponding Source fixed on a durable physical medium | |||||
customarily used for software interchange. | |||||
b) Convey the object code in, or embodied in, a physical product | |||||
(including a physical distribution medium), accompanied by a | |||||
written offer, valid for at least three years and valid for as | |||||
long as you offer spare parts or customer support for that product | |||||
model, to give anyone who possesses the object code either (1) a | |||||
copy of the Corresponding Source for all the software in the | |||||
product that is covered by this License, on a durable physical | |||||
medium customarily used for software interchange, for a price no | |||||
more than your reasonable cost of physically performing this | |||||
conveying of source, or (2) access to copy the | |||||
Corresponding Source from a network server at no charge. | |||||
c) Convey individual copies of the object code with a copy of the | |||||
written offer to provide the Corresponding Source. This | |||||
alternative is allowed only occasionally and noncommercially, and | |||||
only if you received the object code with such an offer, in accord | |||||
with subsection 6b. | |||||
d) Convey the object code by offering access from a designated | |||||
place (gratis or for a charge), and offer equivalent access to the | |||||
Corresponding Source in the same way through the same place at no | |||||
further charge. You need not require recipients to copy the | |||||
Corresponding Source along with the object code. If the place to | |||||
copy the object code is a network server, the Corresponding Source | |||||
may be on a different server (operated by you or a third party) | |||||
that supports equivalent copying facilities, provided you maintain | |||||
clear directions next to the object code saying where to find the | |||||
Corresponding Source. Regardless of what server hosts the | |||||
Corresponding Source, you remain obligated to ensure that it is | |||||
available for as long as needed to satisfy these requirements. | |||||
e) Convey the object code using peer-to-peer transmission, provided | |||||
you inform other peers where the object code and Corresponding | |||||
Source of the work are being offered to the general public at no | |||||
charge under subsection 6d. | |||||
A separable portion of the object code, whose source code is excluded | |||||
from the Corresponding Source as a System Library, need not be | |||||
included in conveying the object code work. | |||||
A "User Product" is either (1) a "consumer product", which means any | |||||
tangible personal property which is normally used for personal, family, | |||||
or household purposes, or (2) anything designed or sold for incorporation | |||||
into a dwelling. In determining whether a product is a consumer product, | |||||
doubtful cases shall be resolved in favor of coverage. For a particular | |||||
product received by a particular user, "normally used" refers to a | |||||
typical or common use of that class of product, regardless of the status | |||||
of the particular user or of the way in which the particular user | |||||
actually uses, or expects or is expected to use, the product. A product | |||||
is a consumer product regardless of whether the product has substantial | |||||
commercial, industrial or non-consumer uses, unless such uses represent | |||||
the only significant mode of use of the product. | |||||
"Installation Information" for a User Product means any methods, | |||||
procedures, authorization keys, or other information required to install | |||||
and execute modified versions of a covered work in that User Product from | |||||
a modified version of its Corresponding Source. The information must | |||||
suffice to ensure that the continued functioning of the modified object | |||||
code is in no case prevented or interfered with solely because | |||||
modification has been made. | |||||
If you convey an object code work under this section in, or with, or | |||||
specifically for use in, a User Product, and the conveying occurs as | |||||
part of a transaction in which the right of possession and use of the | |||||
User Product is transferred to the recipient in perpetuity or for a | |||||
fixed term (regardless of how the transaction is characterized), the | |||||
Corresponding Source conveyed under this section must be accompanied | |||||
by the Installation Information. But this requirement does not apply | |||||
if neither you nor any third party retains the ability to install | |||||
modified object code on the User Product (for example, the work has | |||||
been installed in ROM). | |||||
The requirement to provide Installation Information does not include a | |||||
requirement to continue to provide support service, warranty, or updates | |||||
for a work that has been modified or installed by the recipient, or for | |||||
the User Product in which it has been modified or installed. Access to a | |||||
network may be denied when the modification itself materially and | |||||
adversely affects the operation of the network or violates the rules and | |||||
protocols for communication across the network. | |||||
Corresponding Source conveyed, and Installation Information provided, | |||||
in accord with this section must be in a format that is publicly | |||||
documented (and with an implementation available to the public in | |||||
source code form), and must require no special password or key for | |||||
unpacking, reading or copying. | |||||
7. Additional Terms. | |||||
"Additional permissions" are terms that supplement the terms of this | |||||
License by making exceptions from one or more of its conditions. | |||||
Additional permissions that are applicable to the entire Program shall | |||||
be treated as though they were included in this License, to the extent | |||||
that they are valid under applicable law. If additional permissions | |||||
apply only to part of the Program, that part may be used separately | |||||
under those permissions, but the entire Program remains governed by | |||||
this License without regard to the additional permissions. | |||||
When you convey a copy of a covered work, you may at your option | |||||
remove any additional permissions from that copy, or from any part of | |||||
it. (Additional permissions may be written to require their own | |||||
removal in certain cases when you modify the work.) You may place | |||||
additional permissions on material, added by you to a covered work, | |||||
for which you have or can give appropriate copyright permission. | |||||
Notwithstanding any other provision of this License, for material you | |||||
add to a covered work, you may (if authorized by the copyright holders of | |||||
that material) supplement the terms of this License with terms: | |||||
a) Disclaiming warranty or limiting liability differently from the | |||||
terms of sections 15 and 16 of this License; or | |||||
b) Requiring preservation of specified reasonable legal notices or | |||||
author attributions in that material or in the Appropriate Legal | |||||
Notices displayed by works containing it; or | |||||
c) Prohibiting misrepresentation of the origin of that material, or | |||||
requiring that modified versions of such material be marked in | |||||
reasonable ways as different from the original version; or | |||||
d) Limiting the use for publicity purposes of names of licensors or | |||||
authors of the material; or | |||||
e) Declining to grant rights under trademark law for use of some | |||||
trade names, trademarks, or service marks; or | |||||
f) Requiring indemnification of licensors and authors of that | |||||
material by anyone who conveys the material (or modified versions of | |||||
it) with contractual assumptions of liability to the recipient, for | |||||
any liability that these contractual assumptions directly impose on | |||||
those licensors and authors. | |||||
All other non-permissive additional terms are considered "further | |||||
restrictions" within the meaning of section 10. If the Program as you | |||||
received it, or any part of it, contains a notice stating that it is | |||||
governed by this License along with a term that is a further | |||||
restriction, you may remove that term. If a license document contains | |||||
a further restriction but permits relicensing or conveying under this | |||||
License, you may add to a covered work material governed by the terms | |||||
of that license document, provided that the further restriction does | |||||
not survive such relicensing or conveying. | |||||
If you add terms to a covered work in accord with this section, you | |||||
must place, in the relevant source files, a statement of the | |||||
additional terms that apply to those files, or a notice indicating | |||||
where to find the applicable terms. | |||||
Additional terms, permissive or non-permissive, may be stated in the | |||||
form of a separately written license, or stated as exceptions; | |||||
the above requirements apply either way. | |||||
8. Termination. | |||||
You may not propagate or modify a covered work except as expressly | |||||
provided under this License. Any attempt otherwise to propagate or | |||||
modify it is void, and will automatically terminate your rights under | |||||
this License (including any patent licenses granted under the third | |||||
paragraph of section 11). | |||||
However, if you cease all violation of this License, then your | |||||
license from a particular copyright holder is reinstated (a) | |||||
provisionally, unless and until the copyright holder explicitly and | |||||
finally terminates your license, and (b) permanently, if the copyright | |||||
holder fails to notify you of the violation by some reasonable means | |||||
prior to 60 days after the cessation. | |||||
Moreover, your license from a particular copyright holder is | |||||
reinstated permanently if the copyright holder notifies you of the | |||||
violation by some reasonable means, this is the first time you have | |||||
received notice of violation of this License (for any work) from that | |||||
copyright holder, and you cure the violation prior to 30 days after | |||||
your receipt of the notice. | |||||
Termination of your rights under this section does not terminate the | |||||
licenses of parties who have received copies or rights from you under | |||||
this License. If your rights have been terminated and not permanently | |||||
reinstated, you do not qualify to receive new licenses for the same | |||||
material under section 10. | |||||
9. Acceptance Not Required for Having Copies. | |||||
You are not required to accept this License in order to receive or | |||||
run a copy of the Program. Ancillary propagation of a covered work | |||||
occurring solely as a consequence of using peer-to-peer transmission | |||||
to receive a copy likewise does not require acceptance. However, | |||||
nothing other than this License grants you permission to propagate or | |||||
modify any covered work. These actions infringe copyright if you do | |||||
not accept this License. Therefore, by modifying or propagating a | |||||
covered work, you indicate your acceptance of this License to do so. | |||||
10. Automatic Licensing of Downstream Recipients. | |||||
Each time you convey a covered work, the recipient automatically | |||||
receives a license from the original licensors, to run, modify and | |||||
propagate that work, subject to this License. You are not responsible | |||||
for enforcing compliance by third parties with this License. | |||||
An "entity transaction" is a transaction transferring control of an | |||||
organization, or substantially all assets of one, or subdividing an | |||||
organization, or merging organizations. If propagation of a covered | |||||
work results from an entity transaction, each party to that | |||||
transaction who receives a copy of the work also receives whatever | |||||
licenses to the work the party's predecessor in interest had or could | |||||
give under the previous paragraph, plus a right to possession of the | |||||
Corresponding Source of the work from the predecessor in interest, if | |||||
the predecessor has it or can get it with reasonable efforts. | |||||
You may not impose any further restrictions on the exercise of the | |||||
rights granted or affirmed under this License. For example, you may | |||||
not impose a license fee, royalty, or other charge for exercise of | |||||
rights granted under this License, and you may not initiate litigation | |||||
(including a cross-claim or counterclaim in a lawsuit) alleging that | |||||
any patent claim is infringed by making, using, selling, offering for | |||||
sale, or importing the Program or any portion of it. | |||||
11. Patents. | |||||
A "contributor" is a copyright holder who authorizes use under this | |||||
License of the Program or a work on which the Program is based. The | |||||
work thus licensed is called the contributor's "contributor version". | |||||
A contributor's "essential patent claims" are all patent claims | |||||
owned or controlled by the contributor, whether already acquired or | |||||
hereafter acquired, that would be infringed by some manner, permitted | |||||
by this License, of making, using, or selling its contributor version, | |||||
but do not include claims that would be infringed only as a | |||||
consequence of further modification of the contributor version. For | |||||
purposes of this definition, "control" includes the right to grant | |||||
patent sublicenses in a manner consistent with the requirements of | |||||
this License. | |||||
Each contributor grants you a non-exclusive, worldwide, royalty-free | |||||
patent license under the contributor's essential patent claims, to | |||||
make, use, sell, offer for sale, import and otherwise run, modify and | |||||
propagate the contents of its contributor version. | |||||
In the following three paragraphs, a "patent license" is any express | |||||
agreement or commitment, however denominated, not to enforce a patent | |||||
(such as an express permission to practice a patent or covenant not to | |||||
sue for patent infringement). To "grant" such a patent license to a | |||||
party means to make such an agreement or commitment not to enforce a | |||||
patent against the party. | |||||
If you convey a covered work, knowingly relying on a patent license, | |||||
and the Corresponding Source of the work is not available for anyone | |||||
to copy, free of charge and under the terms of this License, through a | |||||
publicly available network server or other readily accessible means, | |||||
then you must either (1) cause the Corresponding Source to be so | |||||
available, or (2) arrange to deprive yourself of the benefit of the | |||||
patent license for this particular work, or (3) arrange, in a manner | |||||
consistent with the requirements of this License, to extend the patent | |||||
license to downstream recipients. "Knowingly relying" means you have | |||||
actual knowledge that, but for the patent license, your conveying the | |||||
covered work in a country, or your recipient's use of the covered work | |||||
in a country, would infringe one or more identifiable patents in that | |||||
country that you have reason to believe are valid. | |||||
If, pursuant to or in connection with a single transaction or | |||||
arrangement, you convey, or propagate by procuring conveyance of, a | |||||
covered work, and grant a patent license to some of the parties | |||||
receiving the covered work authorizing them to use, propagate, modify | |||||
or convey a specific copy of the covered work, then the patent license | |||||
you grant is automatically extended to all recipients of the covered | |||||
work and works based on it. | |||||
A patent license is "discriminatory" if it does not include within | |||||
the scope of its coverage, prohibits the exercise of, or is | |||||
conditioned on the non-exercise of one or more of the rights that are | |||||
specifically granted under this License. You may not convey a covered | |||||
work if you are a party to an arrangement with a third party that is | |||||
in the business of distributing software, under which you make payment | |||||
to the third party based on the extent of your activity of conveying | |||||
the work, and under which the third party grants, to any of the | |||||
parties who would receive the covered work from you, a discriminatory | |||||
patent license (a) in connection with copies of the covered work | |||||
conveyed by you (or copies made from those copies), or (b) primarily | |||||
for and in connection with specific products or compilations that | |||||
contain the covered work, unless you entered into that arrangement, | |||||
or that patent license was granted, prior to 28 March 2007. | |||||
Nothing in this License shall be construed as excluding or limiting | |||||
any implied license or other defenses to infringement that may | |||||
otherwise be available to you under applicable patent law. | |||||
12. No Surrender of Others' Freedom. | |||||
If conditions are imposed on you (whether by court order, agreement or | |||||
otherwise) that contradict the conditions of this License, they do not | |||||
excuse you from the conditions of this License. If you cannot convey a | |||||
covered work so as to satisfy simultaneously your obligations under this | |||||
License and any other pertinent obligations, then as a consequence you may | |||||
not convey it at all. For example, if you agree to terms that obligate you | |||||
to collect a royalty for further conveying from those to whom you convey | |||||
the Program, the only way you could satisfy both those terms and this | |||||
License would be to refrain entirely from conveying the Program. | |||||
13. Remote Network Interaction; Use with the GNU General Public License. | |||||
Notwithstanding any other provision of this License, if you modify the | |||||
Program, your modified version must prominently offer all users | |||||
interacting with it remotely through a computer network (if your version | |||||
supports such interaction) an opportunity to receive the Corresponding | |||||
Source of your version by providing access to the Corresponding Source | |||||
from a network server at no charge, through some standard or customary | |||||
means of facilitating copying of software. This Corresponding Source | |||||
shall include the Corresponding Source for any work covered by version 3 | |||||
of the GNU General Public License that is incorporated pursuant to the | |||||
following paragraph. | |||||
Notwithstanding any other provision of this License, you have | |||||
permission to link or combine any covered work with a work licensed | |||||
under version 3 of the GNU General Public License into a single | |||||
combined work, and to convey the resulting work. The terms of this | |||||
License will continue to apply to the part which is the covered work, | |||||
but the work with which it is combined will remain governed by version | |||||
3 of the GNU General Public License. | |||||
14. Revised Versions of this License. | |||||
The Free Software Foundation may publish revised and/or new versions of | |||||
the GNU Affero General Public License from time to time. Such new versions | |||||
will be similar in spirit to the present version, but may differ in detail to | |||||
address new problems or concerns. | |||||
Each version is given a distinguishing version number. If the | |||||
Program specifies that a certain numbered version of the GNU Affero General | |||||
Public License "or any later version" applies to it, you have the | |||||
option of following the terms and conditions either of that numbered | |||||
version or of any later version published by the Free Software | |||||
Foundation. If the Program does not specify a version number of the | |||||
GNU Affero General Public License, you may choose any version ever published | |||||
by the Free Software Foundation. | |||||
If the Program specifies that a proxy can decide which future | |||||
versions of the GNU Affero General Public License can be used, that proxy's | |||||
public statement of acceptance of a version permanently authorizes you | |||||
to choose that version for the Program. | |||||
Later license versions may give you additional or different | |||||
permissions. However, no additional obligations are imposed on any | |||||
author or copyright holder as a result of your choosing to follow a | |||||
later version. | |||||
15. Disclaimer of Warranty. | |||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |||||
16. Limitation of Liability. | |||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |||||
SUCH DAMAGES. | |||||
17. Interpretation of Sections 15 and 16. | |||||
If the disclaimer of warranty and limitation of liability provided | |||||
above cannot be given local legal effect according to their terms, | |||||
reviewing courts shall apply local law that most closely approximates | |||||
an absolute waiver of all civil liability in connection with the | |||||
Program, unless a warranty or assumption of liability accompanies a | |||||
copy of the Program in return for a fee. | |||||
END OF TERMS AND CONDITIONS | |||||
How to Apply These Terms to Your New Programs | |||||
If you develop a new program, and you want it to be of the greatest | |||||
possible use to the public, the best way to achieve this is to make it | |||||
free software which everyone can redistribute and change under these terms. | |||||
To do so, attach the following notices to the program. It is safest | |||||
to attach them to the start of each source file to most effectively | |||||
state the exclusion of warranty; and each file should have at least | |||||
the "copyright" line and a pointer to where the full notice is found. | |||||
<one line to give the program's name and a brief idea of what it does.> | |||||
Copyright (C) <year> <name of author> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU Affero General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU Affero General Public License for more details. | |||||
You should have received a copy of the GNU Affero General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
Also add information on how to contact you by electronic and paper mail. | |||||
If your software can interact with users remotely through a computer | |||||
network, you should also make sure that it provides a way for users to | |||||
get its source. For example, if your program is a web application, its | |||||
interface could display a "Source" link that leads users to an archive | |||||
of the code. There are many ways you could offer source, and different | |||||
solutions will be better for different programs; see section 13 for the | |||||
specific requirements. | |||||
You should also get your employer (if you work as a programmer) or school, | |||||
if any, to sign a "copyright disclaimer" for the program, if necessary. | |||||
For more information on this, and how to apply and follow the GNU AGPL, see | |||||
<http://www.gnu.org/licenses/>. |
# OpenViBE Designer | |||||
This repository contains the Designer graphical interface, based on OpenViBE SDK. It also contains various visualization plugins. | |||||
## Build | |||||
In order to compile this project you will need to have the openvibe-sdk dependency compiled somewhere. You can install the last released version | |||||
via dependencies or use a folder compiled locally folder. | |||||
Let us call this path `PATH_OPENVIBE_SDK`. The other requirement is to know where Certivibe dependencies can be found, let us call this path | |||||
`PATH_OPENVIBE_SDK_DEPENDENCIES`. Finally, let us call the location of the source code `PATH_DESIGNER_SOURCE`. | |||||
### Pre-requisites | |||||
In order to build Designer, you need a compiler installed. On Windows you need to have Visual Studio 2013 installed, the build system is based on CMake and Ninja, | |||||
if you don't want to install it on your system, then you can unzip it locally with command by: | |||||
Going to `PATH_DESIGNER_SOURCE\scripts` and open command terminal, set variable PROXYPASS with `username:passwd` and run (or use `windows-install-dependencies-auth.cmd` -> see below): | |||||
``` | |||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -file "windows-get-dependencies.ps1" -manifest_file .\windows-build-tools.txt | |||||
``` | |||||
### Windows | |||||
#### Installing Designer Dependencies | |||||
The simplest way to install dependencies, is, in folder `scripts`: | |||||
* copy `windows-install-dependencies-auth.cmd-skeleton` | |||||
* rename it to `windows-install-dependencies-auth.cmd` | |||||
* edit line `set PROXYPASS=XXX:XXX` with appropriate usernamee and password | |||||
* run it whenever you want to update dependencies. | |||||
This file is ignored by Git, since credentials should not be commited to repository. | |||||
This script install build tools, SDK dependencies and Designer dependencies. If you have your own CMake install and want to use a local version of openvibe-sdk | |||||
you can comment the lines build-tools.txt. | |||||
#### Compile the source code via the script | |||||
The build script can be found in `PATH_DESIGNER_SOURCE\scripts` | |||||
To build Designer in Release mode run: | |||||
windows-build.cmd --sdk PATH_OPENVIBE_SDK --dep PATH_OPENVIBE_SDK_DEPENDENCIES | |||||
#### Creating a Visual Studio project | |||||
A Visual Studio project can be created using scripts. A generator can be found in the `PATH_DESIGNER_SOURCE\scripts` folder. | |||||
windows-generate-vs-project.cmd --sdk "PATH_OPENVIBE_SDK" --dep "PATH_OPENVIBE_SDK_DEPENDENCIES" | |||||
In order to open the visual studio with the correct paths: | |||||
windows-launch-visual-studio.cmd --sdk "PATH_OPENVIBE_SDK" | |||||
Note that currently, only building the project in Release mode is supported if you are using Visual Studio. | |||||
### Linux | |||||
#### Installing Designer Dependencies | |||||
This installation guide supposes that you have already installed the OpenViBE SDK dependencies. | |||||
Go to `PATH_DESIGNER_SOURCE/scripts` and run | |||||
perl linux-install-dependencies.pl | |||||
You will be asked for your root password which you have to grant to the script. | |||||
#### Compile the source code via the script | |||||
The build script is in `PATH_DESIGNER_SOURCE/scripts` | |||||
Run it as so: | |||||
./unix-build --sdk=PATH_OPENVIBE_SDK | |||||
This will build and install Designer in release mode into `PATH_DESIGNER_SOURCE/build/dist` |
# Add all the subdirs as projects of the named branch | |||||
OV_ADD_PROJECTS("APPLICATIONS") |
# Add all the subdirs as projects of the named branch | |||||
OV_ADD_PROJECTS("APPLICATIONS_PLATFORM") | |||||
project(openvibe-designer) | |||||
set(PROJECT_PRODUCT_NAME "${BRAND_NAME} Designer") | |||||
if(WIN32) | |||||
# Should be uncommented once we stop using cmd as launcher | |||||
#SET(ENTRYPOINT WIN32) | |||||
set(ENTRYPOINT ) | |||||
else() | |||||
set(ENTRYPOINT ) | |||||
endif() | |||||
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.h src/*.hpp src/visualization/*.cpp src/dynamic_settings/*.cpp) | |||||
include("FindSourceDependencyJSON") | |||||
set(SRC_FILES "${SRC_FILES};${CMAKE_BINARY_DIR}/resource-files/${LOWER_BRAND_NAME}-${LOWER_DESIGNER_NAME}.rc") | |||||
add_executable(${PROJECT_NAME} ${ENTRYPOINT} ${SRC_FILES}) | |||||
# Generate launch script | |||||
OV_INSTALL_LAUNCH_SCRIPT(SCRIPT_PREFIX "${LOWER_BRAND_NAME}-${LOWER_DESIGNER_NAME}" EXECUTABLE_NAME "${PROJECT_NAME}" ICON_PATH "${OV_ICON_PATH}/designer.ico") | |||||
SET(INCLUDED_OV_SDK_COMPONENTS BASE ALLPLUGINS ALLMODULES DEPENDENCIES) | |||||
include("AddOpenViBESDKComponents") | |||||
include("FindOpenViBEVisualizationToolkit") | |||||
include("FindThirdPartyGTK") | |||||
include("FindThirdPartyBoost") | |||||
include("FindThirdPartyBoost_System") | |||||
include("FindThirdPartyBoost_Thread") | |||||
include("FindThirdPartyBoost_Filesystem") | |||||
add_definitions(-DProjectVersion=\"${OV_GLOBAL_VERSION_STRING}\") | |||||
add_definitions(-DM_VERSION_MAJOR=${OV_GLOBAL_VERSION_MAJOR}) | |||||
add_definitions(-DM_VERSION_MINOR=${OV_GLOBAL_VERSION_MINOR}) | |||||
SET_BUILD_PLATFORM() | |||||
# Install files | |||||
install(TARGETS ${PROJECT_NAME} | |||||
RUNTIME DESTINATION ${DIST_BINDIR} | |||||
LIBRARY DESTINATION ${DIST_LIBDIR} | |||||
ARCHIVE DESTINATION ${DIST_LIBDIR}) | |||||
configure_file(share/designer.conf-base "${CMAKE_CURRENT_BINARY_DIR}/designer.conf" @ONLY) | |||||
configure_file(share/about-dialog.ui-base "${CMAKE_CURRENT_BINARY_DIR}/about-dialog.ui") | |||||
configure_file(share/interface.ui-base "${CMAKE_CURRENT_BINARY_DIR}/interface.ui") | |||||
configure_file(share/interface-settings.ui-base "${CMAKE_CURRENT_BINARY_DIR}/interface-settings.ui") | |||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/designer.conf" DESTINATION ${DIST_DATADIR}/openvibe/applications/designer) | |||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/about-dialog.ui" DESTINATION ${DIST_DATADIR}/openvibe/applications/designer) | |||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/interface.ui" DESTINATION ${DIST_DATADIR}/openvibe/applications/designer) | |||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/interface-settings.ui" DESTINATION ${DIST_DATADIR}/openvibe/applications/designer) | |||||
install(DIRECTORY share/ DESTINATION ${DIST_DATADIR}/openvibe/applications/designer PATTERN PATTERN "*-base*" EXCLUDE) | |||||
<?xml version="1.0"?> | |||||
<interface> | |||||
<requires lib="gtk+" version="2.16"/> | |||||
<!-- interface-naming-policy project-wide --> | |||||
<object class="GtkAboutDialog" id="about"> | |||||
<property name="border_width">5</property> | |||||
<property name="resizable">False</property> | |||||
<property name="modal">True</property> | |||||
<property name="type_hint">dialog</property> | |||||
<property name="program_name">@BRAND_NAME@ @DESIGNER_NAME@</property> | |||||
<property name="version">@OV_GLOBAL_VERSION_STRING@</property> | |||||
<property name="comments" translatable="yes">Software technologies for the development of new research, diagnostic and therapeutic solutions leveraging real-time EEG and neurofeedback. | |||||
Based on OpenViBE, a software from Inria. | |||||
</property> | |||||
<property name="license" translatable="yes"> | |||||
@LICENCE_TEXT@ | |||||
</property> | |||||
<property name="authors">Inria & Mensia Technologies SA | |||||
--- | |||||
Contributors : | |||||
- Guillermo Andrade-Barroso / Inria | |||||
- Quentin Barthélémy / Mensia | |||||
- Laurent Bonnet / Mensia | |||||
- Alison Cellard / Inria | |||||
- Jérôme Chabrol / Inria | |||||
- Vincent Delannoy / Inria | |||||
- Morgane Fauvet / Mensia | |||||
- Charles Garraud / Inria | |||||
- Thierry Gaugry / Inria | |||||
- Esrevi Huynh / Mensia | |||||
- Anatole Lecuyer / Inria | |||||
- Jozef Legény / Mensia | |||||
- Jussi T. Lindgren / Inria | |||||
- Fabien Lotte / Inria | |||||
- Loïc Mahë / Inria | |||||
- Benoit Perrin / Mensia | |||||
- Alexis Placet / Mensia | |||||
- Yann Renard / Mensia | |||||
- Cédric Riou / Inria | |||||
- Guillaume Serrière / Inria | |||||
Testers: | |||||
- Marie Prat / Mensia | |||||
- Agnès Dos Santos / Mensia | |||||
</property> | |||||
<property name="documenters">Inria & Mensia Technologies SA | |||||
--- | |||||
Documenters : | |||||
- Quentin Barthélémy / Mensia | |||||
- Laurent Bonnet / Mensia | |||||
- Jérôme Chabrol / Inria | |||||
- Morgane Fauvet / Mensia | |||||
- Charles Garraud / Inria | |||||
- Thierry Gaugry / Inria | |||||
- Esrevi Huynh / Mensia | |||||
- Jozef Legény / Mensia | |||||
- Jussi T. Lindgren / Inria | |||||
- Alexis Placet / Mensia | |||||
- Marie Prat / Mensia | |||||
- Yann Renard / Mensia | |||||
- Cédric Riou / Inria | |||||
- Agnès Dos Santos / Mensia | |||||
</property> | |||||
<property name="logo">header_logo.png</property> | |||||
<property name="wrap_license">True</property> | |||||
<child internal-child="vbox"> | |||||
<object class="GtkVBox" id="dialog-vbox26"> | |||||
<property name="visible">True</property> | |||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property> | |||||
<property name="spacing">2</property> | |||||
<child internal-child="action_area"> | |||||
<object class="GtkHButtonBox" id="dialog-action_area26"> | |||||
<property name="visible">True</property> | |||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="pack_type">end</property> | |||||
<property name="position">0</property> | |||||
</packing> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
</interface> |
ProjectVersion_Major = @OV_GLOBAL_VERSION_MAJOR@ | |||||
ProjectVersion_Minor = @OV_GLOBAL_VERSION_MINOR@ | |||||
ProjectVersion_Patch = @OV_GLOBAL_VERSION_PATCH@ | |||||
ProjectVersion_Components = \{"openvibe-sdk":"@OV_SDK_VERSION_STRING@", "openvibe-designer":"@OV_GLOBAL_VERSION_MAJOR@.@OV_GLOBAL_VERSION_MINOR@.@OV_GLOBAL_VERSION_PATCH@"\} | |||||
Designer_Locale = C | |||||
Designer_UndoRedoStackSize = 64 | |||||
Designer_ShowAlgorithms = false | |||||
Designer_ShowDeprecated = true | |||||
Designer_ShowOriginalBoxName = true | |||||
Designer_FullscreenEditor = false | |||||
#Designer_FullscreenVisualisation = true | |||||
Designer_UnaffectedVisualizationWindowWidth = 480 | |||||
Designer_UnaffectedVisualizationWindowHeight = 320 | |||||
#Designer_UnaffectedVisualisationWindowFullscreen = false | |||||
Designer_DefaultWorkingDirectory = ${Path_UserData} | |||||
Designer_WindowManager_Center = false | |||||
Designer_ScenarioFileNameTrimmingLimit = 15 | |||||
Designer_ScenarioTabsVerticalStack = false | |||||
Designer_ThrowPopUpWhenBoxIsOutdated = false | |||||
Designer_WebBrowserCommand_Windows = start "" | |||||
Designer_WebBrowserCommand_Linux = nohup xdg-open | |||||
Designer_WebBrowserCommand_MacOS = open | |||||
Designer_WebBrowserCommand = ${Designer_WebBrowserCommand_${OperatingSystem}} | |||||
Designer_WebBrowserCommandPostfix_Windows = | |||||
Designer_WebBrowserCommandPostfix_Linux = >/dev/null 2>&1 | |||||
Designer_WebBrowserCommandPostfix_MacOS = & | |||||
Designer_WebBrowserCommandPostfix = ${Designer_WebBrowserCommandPostfix_${OperatingSystem}} | |||||
Designer_WebBrowserOpenViBEHomepage = http://openvibe.inria.fr/ | |||||
Designer_WebBrowserSupportURL = ${Designer_WebBrowserOpenViBEHomepage}/tracker | |||||
Designer_WebBrowserHelpURLBase = ${Designer_WebBrowserOpenViBEHomepage}/documentation/@OV_GLOBAL_VERSION_STRING@ | |||||
##################################################################################### | |||||
# Designer Help (F1) Configuration | |||||
##################################################################################### | |||||
Designer_HelpBrowserCommand_Windows = ${Designer_WebBrowserCommand_Windows} | |||||
Designer_HelpBrowserCommand_Linux = ${Designer_WebBrowserCommand_Linux} | |||||
Designer_HelpBrowserCommand_MacOS = ${Designer_WebBrowserCommand_MacOS} | |||||
Designer_HelpBrowserCommand = ${Designer_WebBrowserCommand} | |||||
Designer_HelpBrowserCommandPostfix_Windows = ${Designer_WebBrowserCommandPostfix_Windows} | |||||
Designer_HelpBrowserCommandPostfix_Linux = ${Designer_WebBrowserCommandPostfix_Linux} | |||||
Designer_HelpBrowserCommandPostfix_MacOS = ${Designer_WebBrowserCommandPostfix_MacOS} | |||||
Designer_HelpBrowserURLBase = ${Designer_WebBrowserHelpURLBase} | |||||
Designer_HelpBrowserDocumentationIndex = ${Designer_WebBrowserOpenViBEHomepage}/documentation-index | |||||
Designer_HelpBrowserCommandPostfix = ${Designer_HelpBrowserCommandPostfix_${OperatingSystem}} | |||||
Designer_ScriptEditorCommand_Windows = notepad | |||||
Designer_ScriptEditorCommand_Linux = xdg-open | |||||
Designer_ScriptEditorCommand_MacOS = open | |||||
Designer_ScriptEditorCommand = ${Designer_ScriptEditorCommand_${OperatingSystem}} | |||||
Designer_PopUpOnError = false | |||||
Designer_AllowUpCastConnection = false | |||||
Designer_ConsoleLogWithHexa = false | |||||
Designer_ConsoleLogTimeInSecond = True | |||||
Designer_ConsoleLogTimePrecision = 3 | |||||
Designer_FastForwardFactor = 100.0 | |||||
#Use all OpenViBE plugins, including SDK, Designer and extras | |||||
Kernel_PluginsPatternMacOS = ${Path_Lib}/libopenvibe-plugins-*.dylib | |||||
Kernel_PluginsPatternLinux = ${Path_Lib}/libopenvibe-plugins-*.so | |||||
Kernel_PluginsPatternWindows = ${Path_Bin}/openvibe-plugins-*.dll | |||||
Designer_CustomConfigurationFile = ${Path_UserData}/openvibe-designer.conf |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<interface> | |||||
<requires lib="gtk+" version="2.22"/> | |||||
<!-- interface-naming-policy project-wide --> | |||||
<object class="GtkDialog" id="dialog-engine-configuration"> | |||||
<property name="can_focus">False</property> | |||||
<property name="title" translatable="yes">NeuroRT Engine Control Panel</property> | |||||
<property name="default_width">800</property> | |||||
<property name="default_height">600</property> | |||||
<property name="destroy_with_parent">True</property> | |||||
<property name="type_hint">normal</property> | |||||
<child internal-child="vbox"> | |||||
<object class="GtkVBox" id="dialog-vbox35"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="spacing">2</property> | |||||
<child> | |||||
<object class="GtkToolbar" id="toolbar3"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<child> | |||||
<object class="GtkToolItem" id="engine-dropdown_engine_type"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="use_action_appearance">False</property> | |||||
<child> | |||||
<object class="GtkComboBox" id="combobox-engine-connection-type"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="model">liststore-engine-connection-types</property> | |||||
<property name="active">0</property> | |||||
<child> | |||||
<object class="GtkCellRendererText" id="cellrenderertext1"/> | |||||
<attributes> | |||||
<attribute name="text">0</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToolButton" id="button-launch-engine-server"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="label" translatable="yes">Launch Engine Server</property> | |||||
<property name="use_underline">True</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToolButton" id="button-configure-acquisition"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="use_action_appearance">False</property> | |||||
<property name="label" translatable="yes">Configure Acquisition</property> | |||||
<property name="use_underline">True</property> | |||||
<property name="stock_id">gtk-properties</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToggleToolButton" id="toggle-acquire-impedance"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="label" translatable="yes">Acquire Impedance</property> | |||||
<property name="use_underline">True</property> | |||||
<property name="stock_id">gtk-go-up</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToolButton" id="button-reinitialize-archway"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="use_action_appearance">False</property> | |||||
<property name="label" translatable="yes">Reinitialize Archway</property> | |||||
<property name="use_underline">True</property> | |||||
<property name="stock_id">gtk-refresh</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkSeparatorToolItem" id="toolbutton1"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToolButton" id="button-start-engine"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="use_action_appearance">False</property> | |||||
<property name="label" translatable="yes">Start Engine</property> | |||||
<property name="use_underline">True</property> | |||||
<property name="stock_id">gtk-media-play</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToolButton" id="button-start-engine-fast"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="use_action_appearance">False</property> | |||||
<property name="label" translatable="yes">Fast Forward</property> | |||||
<property name="use_underline">True</property> | |||||
<property name="stock_id">gtk-media-forward</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkToolButton" id="button-stop-engine"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="use_action_appearance">False</property> | |||||
<property name="label" translatable="yes">Stop Engine</property> | |||||
<property name="use_underline">True</property> | |||||
<property name="stock_id">gtk-media-stop</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="homogeneous">True</property> | |||||
</packing> | |||||
</child> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">True</property> | |||||
<property name="position">0</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkLabel" id="label10"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="label" translatable="yes"><b>Available Pipelines</b></property> | |||||
<property name="use_markup">True</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">True</property> | |||||
<property name="position">1</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkScrolledWindow" id="scrolledwindow5"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">True</property> | |||||
<property name="hscrollbar_policy">never</property> | |||||
<property name="vscrollbar_policy">automatic</property> | |||||
<child> | |||||
<object class="GtkViewport" id="viewport3"> | |||||
<property name="width_request">100</property> | |||||
<property name="height_request">80</property> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="shadow_type">none</property> | |||||
<child> | |||||
<object class="GtkTreeView" id="treeview-engine-pipelines"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">True</property> | |||||
<property name="model">liststore-pipelines</property> | |||||
<property name="headers_clickable">False</property> | |||||
<property name="search_column">1</property> | |||||
<child> | |||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1"> | |||||
<property name="title" translatable="yes">Id</property> | |||||
<child> | |||||
<object class="GtkCellRendererText" id="cellrenderertext2"> | |||||
<property name="alignment">right</property> | |||||
<property name="font">monospace</property> | |||||
</object> | |||||
<attributes> | |||||
<attribute name="text">1</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
<child> | |||||
<object class="GtkTreeViewColumn" id="treeviewcolumn2"> | |||||
<property name="min_width">100</property> | |||||
<property name="title" translatable="yes">Description</property> | |||||
<child> | |||||
<object class="GtkCellRendererText" id="cellrenderertext3"/> | |||||
<attributes> | |||||
<attribute name="text">2</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
<child> | |||||
<object class="GtkTreeViewColumn" id="treeviewcolumn4"> | |||||
<property name="title" translatable="yes">Has Configuration</property> | |||||
<child> | |||||
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf2"> | |||||
<property name="stock_id">gtk-edit</property> | |||||
</object> | |||||
<attributes> | |||||
<attribute name="visible">3</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">True</property> | |||||
<property name="fill">True</property> | |||||
<property name="position">2</property> | |||||
</packing> | |||||
</child> | |||||
<child internal-child="action_area"> | |||||
<object class="GtkHButtonBox" id="dialog-action_area35"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="layout_style">end</property> | |||||
<child> | |||||
<object class="GtkSpinner" id="spinner-engine-activity"> | |||||
<property name="width_request">40</property> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">False</property> | |||||
<property name="position">0</property> | |||||
</packing> | |||||
</child> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">True</property> | |||||
<property name="position">3</property> | |||||
</packing> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
<object class="GtkDialog" id="dialog-pipeline-configuration"> | |||||
<property name="width_request">640</property> | |||||
<property name="height_request">600</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="title" translatable="yes">Pipeline Configuration</property> | |||||
<property name="border_width">5</property> | |||||
<property name="modal">True</property> | |||||
<property name="destroy_with_parent">True</property> | |||||
<property name="type_hint">dialog</property> | |||||
<property name="skip_taskbar_hint">True</property> | |||||
<property name="transient_for">dialog-engine-configuration</property> | |||||
<child internal-child="vbox"> | |||||
<object class="GtkVBox" id="dialog-vbox33"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="spacing">2</property> | |||||
<child internal-child="action_area"> | |||||
<object class="GtkHButtonBox" id="dialog-action_area33"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="layout_style">end</property> | |||||
<child> | |||||
<object class="GtkButton" id="button-pipeline-configuration-apply"> | |||||
<property name="label" translatable="yes">Apply</property> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">True</property> | |||||
<property name="receives_default">True</property> | |||||
<property name="use_action_appearance">False</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">False</property> | |||||
<property name="position">0</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkButton" id="button-pipeline-configuration-cancel"> | |||||
<property name="label" translatable="yes">Cancel</property> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">True</property> | |||||
<property name="receives_default">True</property> | |||||
<property name="use_action_appearance">False</property> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">False</property> | |||||
<property name="position">1</property> | |||||
</packing> | |||||
</child> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">False</property> | |||||
<property name="fill">True</property> | |||||
<property name="position">0</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<object class="GtkScrolledWindow" id="scrolledwindow6"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">True</property> | |||||
<property name="hscrollbar_policy">automatic</property> | |||||
<property name="vscrollbar_policy">automatic</property> | |||||
<child> | |||||
<object class="GtkViewport" id="viewport4"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">False</property> | |||||
<property name="shadow_type">none</property> | |||||
<child> | |||||
<object class="GtkTreeView" id="treeview-pipeline-configuration"> | |||||
<property name="visible">True</property> | |||||
<property name="can_focus">True</property> | |||||
<property name="model">liststore-pipeline-configuration</property> | |||||
<property name="headers_clickable">False</property> | |||||
<property name="search_column">0</property> | |||||
<child> | |||||
<object class="GtkTreeViewColumn" id="treeviewcolumn3"> | |||||
<property name="resizable">True</property> | |||||
<property name="sizing">autosize</property> | |||||
<property name="title" translatable="yes">Name</property> | |||||
<child> | |||||
<object class="GtkCellRendererText" id="cellrenderertext6"/> | |||||
<attributes> | |||||
<attribute name="text">1</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
<child> | |||||
<object class="GtkTreeViewColumn" id="treeviewcolumn5"> | |||||
<property name="resizable">True</property> | |||||
<property name="sizing">autosize</property> | |||||
<property name="title" translatable="yes">Default Value</property> | |||||
<child> | |||||
<object class="GtkCellRendererText" id="cellrenderertext5"/> | |||||
<attributes> | |||||
<attribute name="text">2</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
<child> | |||||
<object class="GtkTreeViewColumn" id="treeviewcolumn6"> | |||||
<property name="resizable">True</property> | |||||
<property name="sizing">autosize</property> | |||||
<property name="title" translatable="yes">Value</property> | |||||
<child> | |||||
<object class="GtkCellRendererText" id="pipeline-configuration-cellrenderer-parameter-value"> | |||||
<property name="editable">True</property> | |||||
</object> | |||||
<attributes> | |||||
<attribute name="text">3</attribute> | |||||
</attributes> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
</object> | |||||
<packing> | |||||
<property name="expand">True</property> | |||||
<property name="fill">True</property> | |||||
<property name="position">1</property> | |||||
</packing> | |||||
</child> | |||||
</object> | |||||
</child> | |||||
<action-widgets> | |||||
<action-widget response="1">button-pipeline-configuration-apply</action-widget> | |||||
<action-widget response="-6">button-pipeline-configuration-cancel</action-widget> | |||||
</action-widgets> | |||||
</object> | |||||
<object class="GtkAdjustment" id="engine-activity-adjustment"> | |||||
<property name="upper">100</property> | |||||
<property name="step_increment">1</property> | |||||
<property name="page_increment">10</property> | |||||
</object> | |||||
<object class="GtkListStore" id="liststore-engine-connection-types"> | |||||
<columns> | |||||
<!-- column-name Text --> | |||||
<column type="gchararray"/> | |||||
</columns> | |||||
<data> | |||||
<row> | |||||
<col id="0" translatable="yes">Local</col> | |||||
</row> | |||||
<row> | |||||
<col id="0" translatable="yes">LAN</col> | |||||
</row> | |||||
</data> | |||||
</object> | |||||
<object class="GtkListStore" id="liststore-pipeline-configuration"> | |||||
<columns> | |||||
<!-- column-name pipeline-id --> | |||||
<column type="guint64"/> | |||||
<!-- column-name name --> | |||||
<column type="gchararray"/> | |||||
<!-- column-name default-value --> | |||||
<column type="gchararray"/> | |||||
<!-- column-name value --> | |||||
<column type="gchararray"/> | |||||
</columns> | |||||
</object> | |||||
<object class="GtkListStore" id="liststore-pipelines"> | |||||
<columns> | |||||
<!-- column-name pipeline-id --> | |||||
<column type="guint64"/> | |||||
<!-- column-name pipeline-hex-id --> | |||||
<column type="gchararray"/> | |||||
<!-- column-name pipeline-description --> | |||||
<column type="gchararray"/> | |||||
<!-- column-name pipeline-has-configuration --> | |||||
<column type="gboolean"/> | |||||
</columns> | |||||
</object> | |||||
</interface> |
#pragma once | |||||
#include <string> | |||||
#if defined TARGET_OS_Windows | |||||
#define WIN32_LEAN_AND_MEAN | |||||
#include <Windows.h> | |||||
#include <tlhelp32.h> | |||||
#include <tchar.h> | |||||
#elif defined TARGET_OS_Linux || defined TARGET_OS_MacOS | |||||
#include <cstdlib> | |||||
#include <unistd.h> | |||||
#include <vector> | |||||
#include <fs/IEntryEnumerator.h> | |||||
#include <fs/Files.h> | |||||
#include <iostream> | |||||
#include <fstream> | |||||
#endif | |||||
#if defined TARGET_OS_Linux || defined TARGET_OS_MacOS | |||||
namespace | |||||
{ | |||||
class CProcessEnumeratorCB : public FS::IEntryEnumeratorCallBack | |||||
{ | |||||
public: | |||||
CProcessEnumeratorCB(std::string processName, bool& rbFoundProcess) : m_name(processName), m_found(rbFoundProcess) { } | |||||
virtual FS::boolean callback(FS::IEntryEnumerator::IEntry& entry, FS::IEntryEnumerator::IAttributes& /*attributes*/) | |||||
{ | |||||
std::ifstream fsInputStream; | |||||
FS::Files::openIFStream(fsInputStream, entry.getName()); | |||||
std::string fileContents; | |||||
if (fsInputStream.is_open()) | |||||
{ | |||||
while(!fsInputStream.eof()) { fsInputStream >> fileContents; } | |||||
size_t pos = fileContents.rfind(m_name); | |||||
if (pos != std::string::npos && pos == fileContents.length() - m_name.length() - 1 ) { m_found = true; } | |||||
} | |||||
fsInputStream.close(); | |||||
return true; | |||||
} | |||||
std::string m_name; | |||||
bool& m_found; | |||||
}; | |||||
} | |||||
#endif | |||||
namespace OpenViBE { | |||||
namespace ProcessUtilities { | |||||
bool doesProcessExist(const std::string& name) | |||||
{ | |||||
#if defined TARGET_OS_Windows | |||||
PROCESSENTRY32 pe32; | |||||
// Take a snapshot of all processes in the system. | |||||
const HANDLE processSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | |||||
if (processSnap == INVALID_HANDLE_VALUE) { return false; } | |||||
// Set the size of the structure before using it. | |||||
pe32.dwSize = sizeof(PROCESSENTRY32); | |||||
// Retrieve information about the first process, | |||||
// and exit if unsuccessful | |||||
if (!Process32First(processSnap, &pe32)) | |||||
{ | |||||
CloseHandle(processSnap); // clean the snapshot object | |||||
return false; | |||||
} | |||||
bool bReturnValue = false; | |||||
// Now walk the snapshot of processes | |||||
do { if (name + ".exe" == std::string(pe32.szExeFile)) { bReturnValue = true; } } while (Process32Next(processSnap, &pe32)); | |||||
CloseHandle(processSnap); | |||||
return bReturnValue; | |||||
#elif defined TARGET_OS_Linux || defined TARGET_OS_MacOS | |||||
bool found = false; | |||||
CProcessEnumeratorCB* cb = new CProcessEnumeratorCB(name, found); | |||||
FS::IEntryEnumerator* entry = FS::createEntryEnumerator(*cb); | |||||
entry->enumerate("/proc/*/cmdline"); | |||||
entry->release(); | |||||
delete cb; | |||||
return found; | |||||
#endif | |||||
} | |||||
bool launchCommand(const char* sCommandLine) | |||||
{ | |||||
#if defined TARGET_OS_Windows | |||||
/* | |||||
LPTSTR szCmdline = TEXT(const_cast<char*>(sCommandLine)); | |||||
STARTUPINFO lpStartupInfo; | |||||
ZeroMemory(&lpStartupInfo,sizeof(lpStartupInfo)); | |||||
lpStartupInfo.cb = sizeof(lpStartupInfo); | |||||
lpStartupInfo.dwFlags |= CREATE_NEW_CONSOLE; | |||||
PROCESS_INFORMATION lpProcessInfo; | |||||
// Create the process | |||||
if (!CreateProcess(nullptr,szCmdline, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &lpStartupInfo, &lpProcessInfo)) { exit(1); } | |||||
*/ | |||||
const std::string cmd = "start \"\" \"" + std::string(sCommandLine) + "\""; | |||||
system(cmd.c_str()); | |||||
#elif defined TARGET_OS_Linux || defined TARGET_OS_MacOS | |||||
if (fork() == 0) | |||||
{ | |||||
system(sCommandLine); | |||||
exit(0); | |||||
} | |||||
// FIXME: temporary solution using system() | |||||
#endif | |||||
return true; | |||||
} | |||||
} // namespace ProcessUtilities | |||||
} // namespace OpenViBE |
#ifdef MENSIA_DISTRIBUTION | |||||
#include "ovdCArchwayHandler.h" | |||||
#include <openvibe/ov_directories.h> | |||||
#include <openvibe/kernel/log/ovILogManager.h> | |||||
#include <openvibe/kernel/configuration/ovIConfigurationManager.h> | |||||
#include <fs/Files.h> | |||||
#include <ios> | |||||
#include <cassert> | |||||
#include <fstream> | |||||
#include <sstream> | |||||
#include <regex> | |||||
namespace OpenViBE { | |||||
const std::string CArchwayHandler::ARCHWAY_CONFIG_FILE = (Directories::getUserDataDir() + "/studio-archway.conf").toASCIIString(); | |||||
const std::string CArchwayHandler::ARCHWAY_PIPELINES_CONFIG_FILE = (Directories::getUserDataDir() + "/studio-archway-pipeline-configuration.conf"). | |||||
toASCIIString(); | |||||
std::string CArchwayHandler::getArchwayErrorString() const | |||||
{ | |||||
assert(m_Archway); | |||||
const auto errorCode = m_archway->getLastError(); | |||||
const auto errorString = m_archway->getErrorString(errorCode); | |||||
std::stringstream stream; | |||||
stream << std::hex << errorCode; | |||||
return "[0x" + stream.str() + "] " + errorString; | |||||
} | |||||
EEngineInitialisationStatus CArchwayHandler::initialize() | |||||
{ | |||||
#if defined TARGET_OS_Windows | |||||
m_archwayModule.loadFromPath("mensia-engine.dll", "initialize"); | |||||
#elif defined TARGET_OS_Linux | |||||
m_archwayModule.loadFromPath("libmensia-engine.so", "initialize"); | |||||
#elif defined TARGET_OS_MacOS | |||||
m_archwayModule.loadFromPath("libmensia-engine.dylib", "initialize"); | |||||
#endif | |||||
if (!m_archwayModule.isLoaded()) { return EEngineInitialisationStatus::NotAvailable; } | |||||
m_archway = new struct ArchwayAPI(); | |||||
bool didLoad = true; | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getLastError", &m_archway->getLastError); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getErrorString", &m_archway->getErrorString); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getVersionDescription", &m_archway->getVersionDescription); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getConfigurationParameterAsString", | |||||
&m_archway->getConfigurationParameterAsString); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getPipelineScenarioPath", &m_archway->getPipelineScenarioPath); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "initialize", &m_archway->initialize); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "startAllAcquisitionDevices", &m_archway->startAllAcquisitionDevices); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "startImpedanceCheckOnAllAcquisitionDevices", | |||||
&m_archway->startImpedanceCheckOnAllAcquisitionDevices); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "startEngine", &m_archway->startEngine); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "startEngineInFastForward", &m_archway->startEngineInFastForward); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "stopEngine", &m_archway->stopEngine); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "stopAllAcquisitionDevices", &m_archway->stopAllAcquisitionDevices); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "uninitialize", &m_archway->uninitialize); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "enumerateAvailablePipelines", &m_archway->enumerateAvailablePipelines); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "createPipeline", &m_archway->createPipeline); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "releasePipeline", &m_archway->releasePipeline); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "isPipelineRunning", &m_archway->isPipelineRunning); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "isPipelineInErrorState", &m_archway->isPipelineInErrorState); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "enumeratePipelineParameters", &m_archway->enumeratePipelineParameters); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "setPipelineParameterAsString", &m_archway->setPipelineParameterAsString); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "mainloop", &m_archway->mainloop); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getPendingValueCount", &m_archway->getPendingValueCount); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getPendingValueDimension", &m_archway->getPendingValueDimension); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getPendingValue", &m_archway->getPendingValue); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getPendingLogMessageCount", &m_archway->getPendingLogMessageCount); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "getPendingLogMessage", &m_archway->getPendingLogMessage); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "dropPendingValues", &m_archway->dropPendingValues); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "dropPendingEvents", &m_archway->dropPendingEvents); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "isInitialized", &m_archway->isInitialized); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "isAcquiring", &m_archway->isAcquiring); | |||||
didLoad &= System::CDynamicModuleSymbolLoader::getSymbol<>(m_archwayModule, "isStarted", &m_archway->isStarted); | |||||
if (!didLoad) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to load symbols from Archway library [" << m_archwayModule.getErrorDetails() << | |||||
"]\n"; | |||||
delete m_archway; | |||||
m_archway = nullptr; | |||||
return EEngineInitialisationStatus::NotAvailable; | |||||
} | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Trace << "Working with Archway version: " << m_archway->getVersionDescription() << "\n"; | |||||
// Now initialize the ArchwayBridge structure with closures that bridge to local Archway functions | |||||
// this way we do not have to expose the Archway object or the C API | |||||
m_ArchwayBridge.isStarted = [this]() { return this->m_archway->isStarted(); }; | |||||
m_ArchwayBridge.getAvailableValueMatrixCount = [this](size_t valueChannelId) | |||||
{ | |||||
return this->m_archway->getPendingValueCount(m_RunningPipelineId, valueChannelId); | |||||
}; | |||||
// This function returns the last getPendingValue result as a vector | |||||
// Such encapsulation enables us to avoid a call to getPendingValueDimension | |||||
// from the client plugin. | |||||
m_ArchwayBridge.popValueMatrix = [this](const size_t valueChannelId) | |||||
{ | |||||
std::vector<float> valueMatrix; | |||||
const auto valueChannelDim = this->m_archway->getPendingValueDimension(m_RunningPipelineId, valueChannelId); | |||||
valueMatrix.resize(valueChannelDim); | |||||
if (valueChannelDim > 0) | |||||
{ | |||||
if (!this->m_archway->getPendingValue(m_RunningPipelineId, valueChannelId, &valueMatrix[0])) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to get pending value " << this->getArchwayErrorString().c_str() << "\n"; | |||||
} | |||||
} | |||||
return valueMatrix; | |||||
}; | |||||
// As archway buffers signals we have to expose this function to the client plugins | |||||
m_ArchwayBridge.dropBuffers = [this]() | |||||
{ | |||||
m_archway->dropPendingEvents(0); | |||||
m_archway->dropPendingValues(0); | |||||
return true; | |||||
}; | |||||
// We save the address of the structure in the heap memory as a string and save it in | |||||
// the ConfigurationManager, this is because a box can not communicate directly with the Designer | |||||
std::ostringstream archwayBridgeAddress; | |||||
archwayBridgeAddress << static_cast<void const*>(&m_ArchwayBridge); | |||||
m_kernelCtx.getConfigurationManager().createConfigurationToken("Designer_ArchwayBridgeAddress", archwayBridgeAddress.str().c_str()); | |||||
if (!this->loadPipelineConfigurations()) { return EEngineInitialisationStatus::Failure; } | |||||
m_EngineType = EEngineType::Local; | |||||
// Get the starting engine type from configuration | |||||
std::ifstream archwayConfigFile; | |||||
FS::Files::openIFStream(archwayConfigFile, ARCHWAY_CONFIG_FILE.c_str()); | |||||
if (archwayConfigFile.good()) | |||||
{ | |||||
try | |||||
{ | |||||
std::string line; | |||||
while (std::getline(archwayConfigFile, line)) | |||||
{ | |||||
std::cmatch cm; | |||||
if (std::regex_match(line.c_str(), cm, std::regex("config.server\\s*=\\s*'(lan|local)'"))) | |||||
{ | |||||
if (cm[1] == "lan") { m_EngineType = EEngineType::LAN; } | |||||
} | |||||
else if (std::regex_match(line.c_str(), cm, std::regex("config.device[1]\\s*=\\s*'([^']*)'"))) { m_DeviceURL = cm[1]; } | |||||
} | |||||
} | |||||
catch (...) | |||||
{ | |||||
// An exception will be thrown when using libc++ from ubuntu 14.04 | |||||
// in that case we do nothing and keep the defaults | |||||
} | |||||
} | |||||
if (!this->initializeArchway()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to initialize the engine " << this->getArchwayErrorString().c_str() << "\n"; | |||||
return EEngineInitialisationStatus::Failure; | |||||
} | |||||
char deviceURL[2048]; | |||||
m_archway->getConfigurationParameterAsString("config.device[1]", deviceURL, sizeof(deviceURL)); | |||||
m_DeviceURL = deviceURL; | |||||
return EEngineInitialisationStatus::Success; | |||||
} | |||||
bool CArchwayHandler::uninitialize() | |||||
{ | |||||
assert(m_Archway); | |||||
if (m_archway->isStarted()) | |||||
{ | |||||
if (!m_archway->stopEngine()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to stop Engine " << this->getArchwayErrorString().c_str() << "\n"; | |||||
} | |||||
} | |||||
if (m_archway->isAcquiring()) | |||||
{ | |||||
if (!m_archway->stopAllAcquisitionDevices()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to stop all acquisition devices " << this->getArchwayErrorString().c_str() << | |||||
"\n"; | |||||
} | |||||
} | |||||
if (m_archway->isInitialized()) | |||||
{ | |||||
if (!m_archway->uninitialize()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to uninitialize Archway " << this->getArchwayErrorString().c_str() << "\n"; | |||||
} | |||||
} | |||||
delete m_archway; | |||||
m_archway = nullptr; | |||||
if (!this->savePipelineConfigurations()) { return false; } | |||||
return true; | |||||
} | |||||
CArchwayHandler::~CArchwayHandler() { if (m_archway) { this->uninitialize(); } } | |||||
bool CArchwayHandler::initializeArchway() | |||||
{ | |||||
assert(m_Archway); | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Trace << "Re-initializing engine in [" << (m_EngineType == EEngineType::Local ? "Local" : "LAN") << "]" << | |||||
"\n"; | |||||
return m_archway->initialize("user", "pass", "neurort-studio", ARCHWAY_CONFIG_FILE.c_str()); | |||||
} | |||||
bool CArchwayHandler::uninitializeArchway() | |||||
{ | |||||
assert(m_Archway); | |||||
if (m_archway->isInitialized()) | |||||
{ | |||||
if (!m_archway->uninitialize()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to uninitialize Archway " << this->getArchwayErrorString().c_str() << "\n"; | |||||
return false; | |||||
} | |||||
} | |||||
return true; | |||||
} | |||||
bool CArchwayHandler::reinitializeArchway() | |||||
{ | |||||
assert(m_Archway); | |||||
if (!this->uninitializeArchway()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to uninitialize Engine " << this->getArchwayErrorString().c_str() << "\n"; | |||||
return false; | |||||
} | |||||
this->writeArchwayConfigurationFile(); | |||||
if (!this->initializeArchway()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to initialize Engine " << this->getArchwayErrorString().c_str() << "\n"; | |||||
return false; | |||||
} | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Info << "Archway re-initialized \n"; | |||||
return true; | |||||
} | |||||
bool CArchwayHandler::startEngineWithPipeline(const size_t pipelineClassID, const bool isFastForward, const bool shouldAcquireImpedance) | |||||
{ | |||||
assert(m_Archway); | |||||
if (m_archway->isStarted()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Info << "Engine is already started\n"; | |||||
return true; | |||||
} | |||||
if (!m_archway->isAcquiring()) | |||||
{ | |||||
if (shouldAcquireImpedance) | |||||
{ | |||||
if (!m_archway->startImpedanceCheckOnAllAcquisitionDevices()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Failed to start the impedance acquisition" << this->getArchwayErrorString().c_str() << | |||||
"\n"; | |||||
return false; | |||||
} | |||||
} | |||||
else if (!m_archway->startAllAcquisitionDevices()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Failed to start the data acquisition" << this->getArchwayErrorString().c_str() << "\n"; | |||||
return false; | |||||
} | |||||
} | |||||
m_RunningPipelineId = m_archway->createPipeline(pipelineClassID, ""); | |||||
if (m_RunningPipelineId == 0) | |||||
{ | |||||
m_archway->stopAllAcquisitionDevices(); | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Failed to create pipeline " << this->getArchwayErrorString().c_str() << "\n"; | |||||
return false; | |||||
} | |||||
if (m_pipelineSettings.count(pipelineClassID) != 0) | |||||
{ | |||||
for (auto& parameter : m_pipelineSettings[pipelineClassID]) | |||||
{ | |||||
m_archway->setPipelineParameterAsString(m_RunningPipelineId, parameter.first.c_str(), parameter.second.c_str()); | |||||
} | |||||
} | |||||
if (!(isFastForward ? m_archway->startEngineInFastForward() : m_archway->startEngine())) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Engine failed to start " << this->getArchwayErrorString().c_str() << "\n"; | |||||
const size_t nPendingLogMessage = m_archway->getPendingLogMessageCount(m_RunningPipelineId); | |||||
for (size_t i = 0; i < nPendingLogMessage; ++i) | |||||
{ | |||||
size_t logLevel; | |||||
char messageBuffer[2048]; | |||||
std::string logMessages; | |||||
m_archway->getPendingLogMessage(m_RunningPipelineId, &logLevel, messageBuffer, sizeof(messageBuffer)); | |||||
m_kernelCtx.getLogManager() << Kernel::ELogLevel(logLevel) << messageBuffer; | |||||
} | |||||
if (!m_archway->stopAllAcquisitionDevices()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Failed to stop all acquisition devices " << this->getArchwayErrorString().c_str() << "\n"; | |||||
} | |||||
return false; | |||||
} | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Info << "Engine Started\n"; | |||||
return true; | |||||
} | |||||
bool CArchwayHandler::stopEngine() | |||||
{ | |||||
assert(m_Archway); | |||||
bool hasStopSucceeded = true; | |||||
if (m_archway->isStarted()) | |||||
{ | |||||
if (!m_archway->stopEngine()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to stop Engine " << this->getArchwayErrorString().c_str() << "\n"; | |||||
hasStopSucceeded = false; | |||||
} | |||||
} | |||||
if (m_archway->isAcquiring()) | |||||
{ | |||||
if (!m_archway->stopAllAcquisitionDevices()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to all acquisition devices " << this->getArchwayErrorString().c_str() << "\n"; | |||||
hasStopSucceeded = false; | |||||
} | |||||
} | |||||
if (m_RunningPipelineId != 0) | |||||
{ | |||||
if (!m_archway->releasePipeline(m_RunningPipelineId)) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to release pipeline [" << m_RunningPipelineId << "] " << this-> | |||||
getArchwayErrorString().c_str() << "\n"; | |||||
hasStopSucceeded = false; | |||||
} | |||||
m_RunningPipelineId = 0; | |||||
} | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Info << "Engine Stopped\n"; | |||||
return hasStopSucceeded; | |||||
} | |||||
bool CArchwayHandler::loopEngine() | |||||
{ | |||||
assert(m_Archway); | |||||
const bool success = m_archway->mainloop(); | |||||
const bool isPipelineRunning = m_archway->isPipelineRunning(m_RunningPipelineId); | |||||
const bool isPipelineInErrorState = m_archway->isPipelineInErrorState(m_RunningPipelineId); | |||||
if (!isPipelineRunning) { m_kernelCtx.getLogManager() << Kernel::LogLevel_Info << "Pipeline [" << m_RunningPipelineId << "] is not running.\n"; } | |||||
if (isPipelineInErrorState) { m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Pipeline [" << m_RunningPipelineId << "] is in error state.\n"; } | |||||
const size_t nPendingLogMessage = m_archway->getPendingLogMessageCount(m_RunningPipelineId); | |||||
for (size_t i = 0; i < nPendingLogMessage; ++i) | |||||
{ | |||||
size_t logLevel; | |||||
char messageBuffer[2048]; | |||||
std::string logMessages; | |||||
m_archway->getPendingLogMessage(m_RunningPipelineId, &logLevel, messageBuffer, sizeof(messageBuffer)); | |||||
m_kernelCtx.getLogManager() << Kernel::ELogLevel(logLevel) << messageBuffer; | |||||
} | |||||
if (!isPipelineRunning || isPipelineInErrorState) | |||||
{ | |||||
if (!this->stopEngine()) { return false; } | |||||
m_GUIBridge.refreshStoppedEngine(); | |||||
return success && !isPipelineInErrorState; | |||||
} | |||||
return success; | |||||
} | |||||
bool CArchwayHandler::isEngineStarted() | |||||
{ | |||||
if (!m_archway) { return false; } | |||||
return m_archway->isStarted(); | |||||
} | |||||
namespace { | |||||
void enumerateEnginePipelinesCallback(const size_t pipelineID, const char* pipelineDescription, void* userData) | |||||
{ | |||||
const auto callbackParameters = static_cast<std::pair<std::vector<SPipeline>*, std::map<size_t, std::map<std::string, std::string>>*>*>(userData); | |||||
auto enginePipelines = callbackParameters->first; | |||||
const auto pipelineSettings = callbackParameters->second; | |||||
enginePipelines->push_back({ pipelineID, pipelineDescription, pipelineSettings->count(pipelineID) != 0 }); | |||||
} | |||||
void enumeratePipelineParametersCallback(size_t/*pipelineID*/, const char* parameterName, const char* parameterValue, void* userData) | |||||
{ | |||||
// This callback will go through the pipeline parameters one by one and push them into the | |||||
// vector of SPipelineParameters which is passed as the first element of the data input pair | |||||
// This callback receives the parameter's name and default value from Archway, which is why we pass | |||||
// it the list of the _currently set_ parameters for the pipeline | |||||
const auto parameters = static_cast<std::pair<std::vector<SPipelineParameter>*, std::map<std::string, std::string> const*>*>(userData); | |||||
// Our output parameter is the list of pipeline parameters | |||||
auto pipelineParameters = parameters->first; | |||||
// Our additional input parameter is the map of currently set parameters for the pipeline | |||||
// (note that if no parameters are set for the pipeline then this pointer will be null) | |||||
const auto pipelineSettings = parameters->second; | |||||
// Search for the currently set value of the currently handled parameter | |||||
std::string str; | |||||
if (pipelineSettings && pipelineSettings->count(parameterName) != 0) { str = pipelineSettings->at(parameterName); } | |||||
pipelineParameters->push_back({ parameterName, parameterValue, str }); | |||||
} | |||||
} // namespace | |||||
std::vector<SPipeline> CArchwayHandler::getEnginePipelines() const | |||||
{ | |||||
assert(m_Archway); | |||||
std::vector<SPipeline> enginePipelines; | |||||
auto callbackParameters = make_pair(&enginePipelines, &m_pipelineSettings); | |||||
if (!m_archway->enumerateAvailablePipelines(enumerateEnginePipelinesCallback, &callbackParameters)) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed enumerate the available pipelines " << this->getArchwayErrorString().c_str() << "\n"; | |||||
} | |||||
return enginePipelines; | |||||
} | |||||
std::vector<SPipelineParameter> CArchwayHandler::getPipelineParameters(const size_t pipelineClassID) const | |||||
{ | |||||
assert(m_Archway); | |||||
std::vector<SPipelineParameter> pipelineParameters; | |||||
std::map<std::string, std::string> const* pipelineSettings = nullptr; | |||||
if (m_pipelineSettings.count(pipelineClassID) != 0) { pipelineSettings = &m_pipelineSettings.at(pipelineClassID); } | |||||
auto callbackParameters = std::make_pair(&pipelineParameters, pipelineSettings); | |||||
const size_t pipelineID = m_archway->createPipeline(pipelineClassID, ""); | |||||
if (!m_archway->enumeratePipelineParameters(pipelineID, enumeratePipelineParametersCallback, &callbackParameters)) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed enumerate the pipeline's parameters " << this->getArchwayErrorString().c_str() << | |||||
"\n"; | |||||
} | |||||
if (!m_archway->releasePipeline(pipelineID)) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Failed to release pipeline " << this->getArchwayErrorString().c_str() << "\n"; | |||||
} | |||||
return pipelineParameters; | |||||
} | |||||
std::string CArchwayHandler::getPipelineScenarioPath(size_t pipelineClassID) const | |||||
{ | |||||
assert(m_Archway); | |||||
char messageBuffer[2048]; | |||||
std::string logMessages; | |||||
if (!m_archway->getPipelineScenarioPath(pipelineClassID, messageBuffer, sizeof(messageBuffer))) { return ""; } | |||||
return std::string(messageBuffer); | |||||
} | |||||
bool CArchwayHandler::setPipelineParameterValue(const size_t pipelineClassID, std::string const& parameterName, std::string const& parameterValue) | |||||
{ | |||||
if (m_pipelineSettings.find(pipelineClassID) == m_pipelineSettings.end()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Failed to set the value [" << parameterValue << "] to the parameter [" << parameterName << | |||||
"]. The pipeline class id is invalid.\n"; | |||||
return false; | |||||
} | |||||
if (parameterValue != "") { m_pipelineSettings[pipelineClassID][parameterName] = parameterValue; } | |||||
else | |||||
{ | |||||
if (m_pipelineSettings.count(pipelineClassID) != 0) | |||||
{ | |||||
if (m_pipelineSettings[pipelineClassID].count(parameterName) != 0) | |||||
{ | |||||
m_pipelineSettings[pipelineClassID].erase(m_pipelineSettings[pipelineClassID].find(parameterName)); | |||||
if (m_pipelineSettings[pipelineClassID].size() == 0) { m_pipelineSettings.erase(m_pipelineSettings.find(pipelineClassID)); } | |||||
} | |||||
} | |||||
} | |||||
// m_kernelCtx.getLogManager() << Kernel::LogLevel_Info << "Set [" << uiPipelineClassId << "/" << sParameterName << "] to [" << sParameterValue << "]\n"; | |||||
return true; | |||||
} | |||||
bool CArchwayHandler::writeArchwayConfigurationFile() | |||||
{ | |||||
std::ofstream file; | |||||
FS::Files::openOFStream(file, ARCHWAY_CONFIG_FILE.c_str()); | |||||
if (!file.good()) | |||||
{ | |||||
file.close(); | |||||
return false; | |||||
} | |||||
file << "config.server = '" << (m_EngineType == EEngineType::LAN ? "lan" : "local") << "'\n"; | |||||
file << "config.device[1] = '" << m_DeviceURL << "'\n"; | |||||
file.close(); | |||||
return true; | |||||
} | |||||
bool CArchwayHandler::savePipelineConfigurations() | |||||
{ | |||||
std::ofstream file; | |||||
FS::Files::openOFStream(file, ARCHWAY_PIPELINES_CONFIG_FILE.c_str()); | |||||
if (!file.good()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Cannot open file for writing\n"; | |||||
return false; | |||||
} | |||||
for (auto& pipeline : m_pipelineSettings) | |||||
{ | |||||
for (auto& setting : pipeline.second) { file << pipeline.first << "\t" << setting.first << "\t" << setting.second << "\n"; } | |||||
} | |||||
file.close(); | |||||
return true; | |||||
} | |||||
bool CArchwayHandler::loadPipelineConfigurations() | |||||
{ | |||||
std::ifstream file; | |||||
FS::Files::openIFStream(file, ARCHWAY_PIPELINES_CONFIG_FILE.c_str()); | |||||
if (!file.good()) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Trace << "Cannot open Engine Pipeline Configuration file for reading\n"; | |||||
return false; | |||||
} | |||||
while (!file.eof()) | |||||
{ | |||||
size_t pipelineClassID; | |||||
file >> pipelineClassID; | |||||
std::string parameterName; | |||||
// The first one simply trashes the tab after the pipeline Id | |||||
getline(file, parameterName, '\t'); | |||||
getline(file, parameterName, '\t'); | |||||
std::string parameterValue; | |||||
getline(file, parameterValue, '\n'); | |||||
if (parameterValue != "") | |||||
{ | |||||
m_pipelineSettings[pipelineClassID]; | |||||
m_pipelineSettings[pipelineClassID][parameterName] = parameterValue; | |||||
} | |||||
} | |||||
file.close(); | |||||
return true; | |||||
} | |||||
} // namespace OpenViBE | |||||
#endif |
#pragma once | |||||
#ifdef MENSIA_DISTRIBUTION | |||||
#include <memory> | |||||
#include <vector> | |||||
#include <string> | |||||
#include <map> | |||||
#include <functional> | |||||
#include <openvibe/kernel/ovIKernelContext.h> | |||||
#include <gtk/gtk.h> | |||||
#include <system/ovCDynamicModule.h> | |||||
namespace OpenViBE { | |||||
enum class EEngineType { Local, LAN }; | |||||
enum class EEngineInitialisationStatus { Success, Failure, NotAvailable }; | |||||
struct SPipelineParameter | |||||
{ | |||||
std::string name; | |||||
std::string defaultValue; | |||||
std::string value; | |||||
}; | |||||
struct SPipeline | |||||
{ | |||||
size_t id; | |||||
std::string description; | |||||
bool isConfigured; | |||||
}; | |||||
struct SArchwayBridge | |||||
{ | |||||
std::function<bool()> isStarted; | |||||
std::function<size_t(size_t)> getAvailableValueMatrixCount; | |||||
std::function<std::vector<float>(size_t)> popValueMatrix; | |||||
std::function<bool()> dropBuffers; | |||||
}; | |||||
struct SGUIBridge | |||||
{ | |||||
std::function<void()> refreshStoppedEngine; | |||||
}; | |||||
class CArchwayHandler final | |||||
{ | |||||
public: | |||||
explicit CArchwayHandler(const Kernel::IKernelContext& ctx) : m_DeviceURL("simulator://"), m_kernelCtx(ctx) { } | |||||
~CArchwayHandler(); | |||||
EEngineInitialisationStatus initialize(); | |||||
bool uninitialize(); | |||||
bool reinitializeArchway(); | |||||
std::vector<SPipeline> getEnginePipelines() const; | |||||
std::vector<SPipelineParameter> getPipelineParameters(size_t pipelineClassID) const; | |||||
bool setPipelineParameterValue(size_t pipelineClassID, std::string const& parameterName, std::string const& parameterValue); | |||||
std::string getPipelineScenarioPath(size_t pipelineID) const; | |||||
bool startEngineWithPipeline(size_t pipelineClassID, bool isFastForward, bool shouldAcquireImpedance); | |||||
bool loopEngine(); | |||||
bool stopEngine(); | |||||
bool isEngineStarted(); | |||||
bool writeArchwayConfigurationFile(); | |||||
std::map<std::string, std::string>& getPipelineSettings(const size_t pipelineClassID) { return m_pipelineSettings[pipelineClassID]; } | |||||
SArchwayBridge m_ArchwayBridge; | |||||
SGUIBridge m_GUIBridge; | |||||
std::string m_DeviceURL; | |||||
EEngineType m_EngineType = EEngineType::Local; | |||||
private: | |||||
bool initializeArchway(); | |||||
bool uninitializeArchway(); | |||||
bool savePipelineConfigurations(); | |||||
bool loadPipelineConfigurations(); | |||||
std::string getArchwayErrorString() const; | |||||
private: | |||||
typedef void (*FPEnumerateAvailablePipelinesCallback)(size_t pipelineClassID, const char* pipelineDescription, void* userData); | |||||
typedef void (*FPEnumeratePipelineParametersCallback)(size_t pipelineID, const char* parameterName, const char* parameterValue, void* userData); | |||||
struct ArchwayAPI | |||||
{ | |||||
size_t (*getLastError)(); | |||||
const char* (*getErrorString)(size_t errorCode); | |||||
const char* (*getVersionDescription)(); | |||||
void (*getConfigurationParameterAsString)(const char* configurationParameter, char* outputBuffer, size_t bufferLength); | |||||
bool (*getPipelineScenarioPath)(size_t pipelineID, char* messageBuffer, size_t bufferLength); | |||||
bool (*initialize)(const char* login, const char* password, const char* applicationName, const char* configFilename); | |||||
bool (*startAllAcquisitionDevices)(); | |||||
bool (*startImpedanceCheckOnAllAcquisitionDevices)(); | |||||
bool (*startEngine)(); | |||||
bool (*startEngineInFastForward)(); | |||||
bool (*stopEngine)(); | |||||
bool (*stopAllAcquisitionDevices)(); | |||||
bool (*uninitialize)(); | |||||
bool (*enumerateAvailablePipelines)(FPEnumerateAvailablePipelinesCallback callback, void* userData); | |||||
size_t (*createPipeline)(size_t pipelineClassID, const char* profileName); | |||||
bool (*releasePipeline)(size_t pipelineID); | |||||
bool (*isPipelineRunning)(size_t pipelineID); | |||||
bool (*isPipelineInErrorState)(size_t pipelineID); | |||||
bool (*enumeratePipelineParameters)(size_t pipelineID, FPEnumeratePipelineParametersCallback callback, void* userData); | |||||
bool (*setPipelineParameterAsString)(size_t pipelineID, const char* parameterName, const char* value); | |||||
bool (*mainloop)(); | |||||
size_t (*getPendingValueCount)(size_t pipelineID, size_t matrixOutputIdx); | |||||
size_t (*getPendingValueDimension)(size_t pipelineID, size_t matrixOutputIdx); | |||||
bool (*getPendingValue)(size_t pipelineID, size_t matrixOutputIdx, float* value); | |||||
size_t (*getPendingLogMessageCount)(size_t pipelineID); | |||||
bool (*getPendingLogMessage)(size_t pipelineID, size_t* logLevel, char* messageBuffer, size_t bufferSize); | |||||
bool (*dropPendingValues)(size_t pipelineID); | |||||
bool (*dropPendingEvents)(size_t pipelineID); | |||||
bool (*isInitialized)(); | |||||
bool (*isAcquiring)(); | |||||
bool (*isStarted)(); | |||||
}; | |||||
struct ArchwayAPI* m_archway = nullptr; | |||||
System::CDynamicModule m_archwayModule; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
// Current Configuration | |||||
std::map<size_t, std::map<std::string, std::string>> m_pipelineSettings; | |||||
static const std::string ARCHWAY_CONFIG_FILE; | |||||
static const std::string ARCHWAY_PIPELINES_CONFIG_FILE; | |||||
size_t m_RunningPipelineId = 0; | |||||
}; | |||||
} // namespace OpenViBE | |||||
#endif |
#ifdef MENSIA_DISTRIBUTION | |||||
#include "ovdCArchwayHandlerGUI.h" | |||||
#include <openvibe/ov_directories.h> | |||||
#include <fs/Files.h> | |||||
#include <sstream> | |||||
#include <cassert> | |||||
#include <cstdio> | |||||
#include <sstream> | |||||
#include "../ovdCApplication.h" | |||||
#include "ovProcessUtilities.hpp" | |||||
#if defined TARGET_OS_Windows | |||||
#define pclose _pclose | |||||
#endif | |||||
namespace OpenViBE { | |||||
namespace { | |||||
enum EnginePipelinesModelColumn | |||||
{ | |||||
Column_PipelineId = 0, | |||||
Column_PipelineHexId, | |||||
Column_PipelineDescription, | |||||
Column_PipelineIsConfigured | |||||
}; | |||||
enum PipelineConfigurationModelColumn | |||||
{ | |||||
Column_SettingPipelineId = 0, | |||||
Column_SettingName = 1, | |||||
Column_SettingDefaultValue = 2, | |||||
Column_SettingValue = 3 | |||||
}; | |||||
void on_button_configure_acquisition_clicked(GtkMenuItem* menuItem, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
const std::string configToolLaunchCmd = std::string(Directories::getBinDir().toASCIIString()) + "/mensia-device-configuration"; | |||||
//std::string configFilePath = std::string(getenv("USERPROFILE")) + "\\lib-mensia-engine.conf"; | |||||
std::string escapedURL = gui->m_Controller.m_DeviceURL; | |||||
size_t startPosition = 0; | |||||
while ((startPosition = escapedURL.find('\"', startPosition)) != std::string::npos) | |||||
{ | |||||
escapedURL.replace(startPosition, 1, "\\\""); | |||||
startPosition += 2; // Handles case where 'to' is a substring of 'from' | |||||
} | |||||
#if defined TARGET_OS_Windows | |||||
std::string command = "\"\"" + configToolLaunchCmd + "\" --no-file \"" + escapedURL + "\"\""; | |||||
for (std::string stringToEscape : { "^", "<", ">", "&", "|", "%" }) // ^ must be escaped first! | |||||
{ | |||||
startPosition = 0; | |||||
while ((startPosition = command.find(stringToEscape, startPosition)) != std::string::npos) | |||||
{ | |||||
command.replace(startPosition, stringToEscape.size(), "^" + stringToEscape); | |||||
startPosition += 1 + stringToEscape.size(); | |||||
} | |||||
} | |||||
#elif defined TARGET_OS_Linux || defined TARGET_OS_MacOS | |||||
std::string command = configurationToolLaunchCmd + " --no-file \"" + escapedURL + "\""; | |||||
#endif | |||||
FILE* commandPipe = FS::Files::popen(command.c_str(), "r"); | |||||
char buffer[512]; | |||||
std::stringstream urlStream; | |||||
while (fgets(buffer, sizeof(buffer), commandPipe) != nullptr) { urlStream << buffer; } | |||||
pclose(commandPipe); | |||||
auto deviceURL = urlStream.str(); | |||||
deviceURL = deviceURL.substr(0, deviceURL.length() - 1); | |||||
gui->m_Controller.m_DeviceURL = deviceURL; | |||||
gui->m_Controller.writeArchwayConfigurationFile(); | |||||
} | |||||
void on_button_reinitialize_archway_clicked(GtkMenuItem*, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
const auto engineTypeCombobox = GTK_COMBO_BOX(gtk_builder_get_object(gui->m_Builder, "combobox-engine-connection-type")); | |||||
gui->m_Controller.m_EngineType = (gtk_combo_box_get_active(engineTypeCombobox) == 0 ? EEngineType::Local : EEngineType::LAN); | |||||
gui->m_Controller.reinitializeArchway(); | |||||
gui->refreshEnginePipelines(); | |||||
} | |||||
void on_combobox_engine_type_changed(GtkComboBox*, gpointer data) | |||||
{ | |||||
const auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
if (gtk_combo_box_get_active(gui->m_ComboBoxEngineType) == 0) { gtk_widget_set_sensitive(gui->m_ButtonLaunchEngine, FALSE); } | |||||
else { gtk_widget_set_sensitive(gui->m_ButtonLaunchEngine, TRUE); } | |||||
on_button_reinitialize_archway_clicked(nullptr, data); | |||||
} | |||||
gboolean on_dialog_engine_configuration_delete_event(GtkDialog* dialog, GdkEvent*, gpointer data) | |||||
{ | |||||
const auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(gui->m_ButtonOpenEngineConfigurationDialog), false); | |||||
gtk_widget_hide(GTK_WIDGET(dialog)); | |||||
return TRUE; | |||||
} | |||||
gboolean on_dialog_pipeline_configuration_delete_event(GtkDialog* pDialog, GdkEvent*, gpointer) | |||||
{ | |||||
gtk_dialog_response(pDialog, GTK_RESPONSE_CANCEL); | |||||
gtk_widget_hide(GTK_WIDGET(pDialog)); | |||||
return TRUE; | |||||
} | |||||
void view_pipeline_config(CArchwayHandlerGUI* gui) | |||||
{ | |||||
const auto treeModel = gtk_tree_view_get_model(GTK_TREE_VIEW(gui->m_TreeViewEnginePipelines)); | |||||
guint64 pipelineID; | |||||
gtk_tree_model_get(treeModel, &gui->m_SelectedPipelineIter, Column_PipelineId, &pipelineID, -1); | |||||
gui->displayPipelineConfigurationDialog(size_t(pipelineID)); | |||||
auto enginePipelines = gui->m_Controller.getEnginePipelines(); | |||||
for (const auto& pipeline : enginePipelines) | |||||
{ | |||||
if (pipeline.id != pipelineID) { continue; } | |||||
gtk_list_store_set(GTK_LIST_STORE(treeModel), &gui->m_SelectedPipelineIter, Column_PipelineIsConfigured, pipeline.isConfigured, -1); | |||||
} | |||||
} | |||||
void view_popup_menu_onOpenScenario(GtkWidget* menuitem, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
const auto treeModel = gtk_tree_view_get_model(GTK_TREE_VIEW(gui->m_TreeViewEnginePipelines)); | |||||
guint64 pipelineID; | |||||
gtk_tree_model_get(treeModel, &gui->m_SelectedPipelineIter, Column_PipelineId, &pipelineID, -1); | |||||
if (gui->m_Controller.m_EngineType == EEngineType::Local) | |||||
{ | |||||
const std::string path = gui->m_Controller.getPipelineScenarioPath(size_t(pipelineID)); | |||||
gui->m_Application->openScenario(path.c_str()); | |||||
} | |||||
} | |||||
void view_popup_menu_onConfItem(GtkWidget* menuitem, gpointer data) | |||||
{ | |||||
const auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
view_pipeline_config(gui); | |||||
} | |||||
void on_treeview_engine_pipelines_popup_menu(CArchwayHandlerGUI* gui, GdkEventButton* event) | |||||
{ | |||||
GtkWidget* menu = gtk_menu_new(); | |||||
GtkWidget* openConfItem = gtk_menu_item_new_with_label("Open configuration file"); | |||||
g_signal_connect(openConfItem, "activate", GCallback(view_popup_menu_onConfItem), gui); | |||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), openConfItem); | |||||
if (gui->m_Controller.m_EngineType == EEngineType::Local) | |||||
{ | |||||
GtkWidget* openScenarioItem = gtk_menu_item_new_with_label("Open scenario"); | |||||
g_signal_connect(openScenarioItem, "activate", GCallback(view_popup_menu_onOpenScenario), gui); | |||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), openScenarioItem); | |||||
} | |||||
gtk_widget_show_all(menu); | |||||
gtk_menu_popup(GTK_MENU(menu), nullptr, nullptr, nullptr, nullptr, event->button, gdk_event_get_time(reinterpret_cast<GdkEvent*>(event))); | |||||
} | |||||
gboolean on_treeview_engine_pipelines_button_pressed(GtkWidget* treeView, GdkEventButton* event, gpointer userData) | |||||
{ | |||||
// Only acknowledge, if it's a right click, or double click | |||||
if (!(event->type == GDK_BUTTON_PRESS && event->button == 3) && !(event->type == GDK_2BUTTON_PRESS && event->button == 1)) { return FALSE; } | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(userData); | |||||
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gui->m_TreeViewEnginePipelines)); | |||||
if (gtk_tree_selection_count_selected_rows(selection) == 1) | |||||
{ | |||||
gtk_tree_selection_get_selected(selection, &gui->m_TreeModelEnginePipelines, &gui->m_SelectedPipelineIter); | |||||
// single click with the right mouse button | |||||
if (event->type == GDK_BUTTON_PRESS && event->button == 3) | |||||
{ | |||||
on_treeview_engine_pipelines_popup_menu(gui, event); | |||||
return TRUE; | |||||
} | |||||
else if (event->type == GDK_2BUTTON_PRESS && event->button == 1) | |||||
{ | |||||
view_pipeline_config(gui); | |||||
return TRUE; | |||||
} | |||||
} | |||||
return FALSE; | |||||
} | |||||
void startEngine(GtkWidget* widget, gpointer data, bool isFastForward) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
// Get the currently selected pipeline in the list | |||||
const auto selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gui->m_TreeViewEnginePipelines)); | |||||
if (gtk_tree_selection_count_selected_rows(selection) == 1) | |||||
{ | |||||
gtk_tree_selection_get_selected(selection, &gui->m_TreeModelEnginePipelines, &gui->m_SelectedPipelineIter); | |||||
size_t pipelineID = 0; | |||||
gtk_tree_model_get(gui->m_TreeModelEnginePipelines, &gui->m_SelectedPipelineIter, Column_PipelineId, &pipelineID, -1); | |||||
const bool shouldAcquireImpedance = (gtk_toggle_tool_button_get_active(gui->m_ToggleAcquireImpedance) == gboolean(true)); | |||||
if (gui->m_Controller.startEngineWithPipeline(size_t(pipelineID), isFastForward, shouldAcquireImpedance)) | |||||
{ | |||||
gtk_widget_set_sensitive(GTK_WIDGET(gui->m_ToggleAcquireImpedance), false); | |||||
gtk_widget_set_sensitive(GTK_WIDGET(gui->m_ComboBoxEngineType), false); | |||||
gtk_widget_set_sensitive(gui->m_ButtonConfigureAcquisition, false); | |||||
gtk_widget_set_sensitive(gui->m_ButtonLaunchEngine, false); | |||||
gtk_widget_set_sensitive(gui->m_ButtonStartEngine, false); | |||||
gtk_widget_set_sensitive(gui->m_ButtonStartEngineFastFoward, false); | |||||
gtk_widget_set_sensitive(gui->m_ButtonStopEngine, true); | |||||
gtk_widget_set_sensitive(gui->m_TreeViewEnginePipelines, false); | |||||
gtk_spinner_start(gui->m_SpinnerEngineActivity); | |||||
gtk_widget_show(GTK_WIDGET(gui->m_SpinnerEngineActivity)); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
const auto alertDialog = gtk_message_dialog_new(nullptr, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Please select a pipeline to run."); | |||||
gtk_dialog_run(GTK_DIALOG(alertDialog)); | |||||
gtk_widget_destroy(alertDialog); | |||||
} | |||||
} | |||||
void on_button_start_engine_clicked(GtkWidget* widget, gpointer data) { startEngine(widget, data, false); } | |||||
void on_button_start_engine_fast_forward_clicked(GtkWidget* widget, gpointer data) { startEngine(widget, data, true); } | |||||
void on_button_stop_engine_clicked(GtkWidget* widget, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
if (gui->m_Controller.stopEngine()) | |||||
{ | |||||
gtk_widget_set_sensitive(GTK_WIDGET(gui->m_ToggleAcquireImpedance), true); | |||||
gtk_widget_set_sensitive(GTK_WIDGET(gui->m_ComboBoxEngineType), true); | |||||
gtk_widget_set_sensitive(gui->m_ButtonConfigureAcquisition, true); | |||||
gtk_widget_set_sensitive(gui->m_ButtonLaunchEngine, true); | |||||
gtk_widget_set_sensitive(gui->m_ButtonStartEngine, true); | |||||
gtk_widget_set_sensitive(gui->m_ButtonStartEngineFastFoward, true); | |||||
gtk_widget_set_sensitive(gui->m_ButtonStopEngine, false); | |||||
gtk_widget_set_sensitive(gui->m_TreeViewEnginePipelines, true); | |||||
gtk_spinner_stop(gui->m_SpinnerEngineActivity); | |||||
gtk_widget_hide(GTK_WIDGET(gui->m_SpinnerEngineActivity)); | |||||
} | |||||
} | |||||
void on_button_pipeline_configuration_apply_clicked(GtkWidget* widget, gpointer) | |||||
{ | |||||
GtkWidget* dialog = gtk_widget_get_parent(gtk_widget_get_parent((gtk_widget_get_parent(widget)))); | |||||
gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY); | |||||
gtk_widget_hide(dialog); | |||||
} | |||||
void on_button_pipeline_configuration_cancel_clicked(GtkWidget* widget, gpointer) | |||||
{ | |||||
GtkWidget* dialog = gtk_widget_get_parent(gtk_widget_get_parent((gtk_widget_get_parent(widget)))); | |||||
gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); | |||||
gtk_widget_hide(dialog); | |||||
} | |||||
void on_pipeline_configuration_cellrenderer_parameter_value_edited(GtkCellRendererText* cell, gchar* path, gchar* newText, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
gui->setPipelineParameterValueAtPath(path, newText); | |||||
} | |||||
gboolean on_pipeline_configuration_cellrenderer_parameter_value_entry_focus_out(GtkWidget* widget, GdkEvent* event, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
const auto entry = GTK_ENTRY(widget); | |||||
gui->setPipelineParameterValueAtPath(gui->m_CurrentlyEditedCellPath.c_str(), gtk_entry_get_text(entry)); | |||||
return FALSE; | |||||
} | |||||
void on_pipeline_configuration_cellrenderer_parameter_value_editing_started(GtkCellRenderer* cell, GtkCellEditable* editable, gchar* path, gpointer data) | |||||
{ | |||||
auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
// As we are sending data to a callback created within a callback, we really want to avoid | |||||
// allocating memory. | |||||
gui->m_CurrentlyEditedCellPath = path; | |||||
const auto entry = GTK_ENTRY(editable); | |||||
g_signal_connect(G_OBJECT(entry), | |||||
"focus-out-event", | |||||
G_CALLBACK(on_pipeline_configuration_cellrenderer_parameter_value_entry_focus_out), data); | |||||
} | |||||
void on_button_launch_engine_clicked(GtkWidget* widget, gpointer data) | |||||
{ | |||||
// auto gui = static_cast<CArchwayHandlerGUI*>(data); | |||||
if (!ProcessUtilities::doesProcessExist("mensia-engine-server")) | |||||
{ | |||||
#if defined TARGET_OS_Windows | |||||
if (FS::Files::fileExists(Directories::getBinDir() + "/mensia-engine-server.exe")) | |||||
{ | |||||
ProcessUtilities::launchCommand(std::string(Directories::getBinDir() + "/mensia-engine-server.exe").c_str()); | |||||
} | |||||
else if (FS::Files::fileExists("C:/Program Files (x86)/NeuroRT/NeuroRT Engine Server/bin/mensia-engine-server.exe")) | |||||
{ | |||||
ProcessUtilities::launchCommand(std::string("C:/Program Files (x86)/NeuroRT/NeuroRT Engine Server/neurort-engine-server.cmd").c_str()); | |||||
} | |||||
#elif defined TARGET_OS_Linux || defined TARGET_OS_MacOS | |||||
if (FS::Files::fileExists(Directories::getBinDir() + "/mensia-engine-server")) | |||||
{ | |||||
ProcessUtilities::launchCommand(std::string(Directories::getBinDir() + "/mensia-engine-server").c_str()); | |||||
} | |||||
#endif | |||||
} | |||||
} | |||||
} | |||||
CArchwayHandlerGUI::CArchwayHandlerGUI(CArchwayHandler& controller, Designer::CApplication* application) | |||||
: m_Controller(controller), m_Application(application) | |||||
{ | |||||
m_Builder = gtk_builder_new(); | |||||
GError* gtkError = nullptr; | |||||
gtk_builder_add_from_file(m_Builder, Directories::getDataDir() + "/applications/designer/interface-archway.ui", >kError); | |||||
assert(gtkError == nullptr); | |||||
// gtk_builder_connect_signals(m_builder, nullptr); | |||||
m_ButtonConfigureAcquisition = GTK_WIDGET(gtk_builder_get_object(m_Builder, "button-configure-acquisition")); | |||||
g_signal_connect(G_OBJECT(m_ButtonConfigureAcquisition), "clicked", G_CALLBACK(on_button_configure_acquisition_clicked), this); | |||||
m_ButtonReinitializeArchway = GTK_WIDGET(gtk_builder_get_object(m_Builder, "button-reinitialize-archway")); | |||||
g_signal_connect(G_OBJECT(m_ButtonReinitializeArchway), "clicked", G_CALLBACK(on_button_reinitialize_archway_clicked), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(m_Builder, "button-pipeline-configuration-apply")), | |||||
"clicked", G_CALLBACK(on_button_pipeline_configuration_apply_clicked), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(m_Builder, "button-pipeline-configuration-cancel")), | |||||
"clicked", G_CALLBACK(on_button_pipeline_configuration_cancel_clicked), this); | |||||
m_SpinnerEngineActivity = GTK_SPINNER(gtk_builder_get_object(m_Builder, "spinner-engine-activity")); | |||||
gtk_widget_hide(GTK_WIDGET(m_SpinnerEngineActivity)); | |||||
m_ToggleAcquireImpedance = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_Builder, "toggle-acquire-impedance")); | |||||
m_ButtonStartEngine = GTK_WIDGET(gtk_builder_get_object(m_Builder, "button-start-engine")); | |||||
m_ButtonStartEngineFastFoward = GTK_WIDGET(gtk_builder_get_object(m_Builder, "button-start-engine-fast")); | |||||
m_ButtonStopEngine = GTK_WIDGET(gtk_builder_get_object(m_Builder, "button-stop-engine")); | |||||
gtk_widget_set_sensitive(m_ButtonStopEngine, false); | |||||
g_signal_connect(G_OBJECT(m_ButtonStartEngine), "clicked", G_CALLBACK(on_button_start_engine_clicked), this); | |||||
g_signal_connect(G_OBJECT(m_ButtonStartEngineFastFoward), "clicked", G_CALLBACK(on_button_start_engine_fast_forward_clicked), this); | |||||
g_signal_connect(G_OBJECT(m_ButtonStopEngine), "clicked", G_CALLBACK(on_button_stop_engine_clicked), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(m_Builder, "dialog-engine-configuration")), | |||||
"delete-event", G_CALLBACK(on_dialog_engine_configuration_delete_event), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(m_Builder, "dialog-pipeline-configuration")), | |||||
"delete-event", G_CALLBACK(on_dialog_pipeline_configuration_delete_event), this); | |||||
m_TreeViewEnginePipelines = GTK_WIDGET(gtk_builder_get_object(m_Builder, "treeview-engine-pipelines")); | |||||
g_signal_connect(m_TreeViewEnginePipelines, "button-press-event", GCallback(on_treeview_engine_pipelines_button_pressed), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(m_Builder, "pipeline-configuration-cellrenderer-parameter-value")), | |||||
"edited", | |||||
G_CALLBACK(on_pipeline_configuration_cellrenderer_parameter_value_edited), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(m_Builder, "pipeline-configuration-cellrenderer-parameter-value")), | |||||
"editing-started", | |||||
G_CALLBACK(on_pipeline_configuration_cellrenderer_parameter_value_editing_started), this); | |||||
m_TreeModelEnginePipelines = GTK_TREE_MODEL(gtk_builder_get_object(m_Builder, "liststore-pipelines")); | |||||
m_Controller.m_GUIBridge.refreshStoppedEngine = [this]() | |||||
{ | |||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ToggleAcquireImpedance), true); | |||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ComboBoxEngineType), true); | |||||
gtk_widget_set_sensitive(m_ButtonConfigureAcquisition, true); | |||||
gtk_widget_set_sensitive(m_ButtonLaunchEngine, true); | |||||
gtk_widget_set_sensitive(m_ButtonStartEngine, true); | |||||
gtk_widget_set_sensitive(m_ButtonStartEngineFastFoward, true); | |||||
gtk_widget_set_sensitive(m_ButtonStopEngine, false); | |||||
gtk_widget_set_sensitive(m_TreeViewEnginePipelines, true); | |||||
gtk_spinner_stop(m_SpinnerEngineActivity); | |||||
gtk_widget_hide(GTK_WIDGET(m_SpinnerEngineActivity)); | |||||
}; | |||||
m_ComboBoxEngineType = GTK_COMBO_BOX(gtk_builder_get_object(m_Builder, "combobox-engine-connection-type")); | |||||
g_signal_connect(G_OBJECT(m_ComboBoxEngineType), "changed", G_CALLBACK(on_combobox_engine_type_changed), this); | |||||
m_ButtonLaunchEngine = GTK_WIDGET(gtk_builder_get_object(m_Builder, "button-launch-engine-server")); | |||||
g_signal_connect(G_OBJECT(m_ButtonLaunchEngine), "clicked", G_CALLBACK(on_button_launch_engine_clicked), this); | |||||
} | |||||
CArchwayHandlerGUI::~CArchwayHandlerGUI() { if (m_Builder) { g_object_unref(G_OBJECT(m_Builder)); } } | |||||
void CArchwayHandlerGUI::refreshEnginePipelines() | |||||
{ | |||||
const auto listStorePipelines = GTK_LIST_STORE(m_TreeModelEnginePipelines); | |||||
gtk_list_store_clear(listStorePipelines); | |||||
auto enginePipelines = m_Controller.getEnginePipelines(); | |||||
GtkTreeIter iter; | |||||
for (auto& pipeline : enginePipelines) | |||||
{ | |||||
std::stringstream pipelineIdInHex; | |||||
pipelineIdInHex << std::hex << pipeline.id; | |||||
gtk_list_store_append(listStorePipelines, &iter); | |||||
gtk_list_store_set(listStorePipelines, &iter, Column_PipelineId, pipeline.id, Column_PipelineHexId, pipelineIdInHex.str().c_str(), | |||||
Column_PipelineDescription, pipeline.description.c_str(), Column_PipelineIsConfigured, pipeline.isConfigured, -1); | |||||
} | |||||
} | |||||
void CArchwayHandlerGUI::toggleNeuroRTEngineConfigurationDialog(const bool shouldDisplay) | |||||
{ | |||||
const auto engineConfigurationWidget = GTK_WIDGET(gtk_builder_get_object(m_Builder, "dialog-engine-configuration")); | |||||
if (shouldDisplay) | |||||
{ | |||||
gtk_combo_box_set_active(m_ComboBoxEngineType, m_Controller.m_EngineType == EEngineType::Local ? 0 : 1); | |||||
this->refreshEnginePipelines(); | |||||
gtk_widget_show(engineConfigurationWidget); | |||||
} | |||||
else { gtk_widget_hide(engineConfigurationWidget); } | |||||
} | |||||
void CArchwayHandlerGUI::displayPipelineConfigurationDialog(const size_t pipelineID) | |||||
{ | |||||
const auto pipelineConfigurationWidget = GTK_WIDGET(gtk_builder_get_object(m_Builder, "dialog-pipeline-configuration")); | |||||
const auto pipelineConfigurationListStore = GTK_LIST_STORE(gtk_builder_get_object(m_Builder, "liststore-pipeline-configuration")); | |||||
gtk_list_store_clear(pipelineConfigurationListStore); | |||||
auto pipelineParameters = m_Controller.getPipelineParameters(pipelineID); | |||||
GtkTreeIter iter; | |||||
for (auto& parameter : pipelineParameters) | |||||
{ | |||||
gtk_list_store_append(pipelineConfigurationListStore, &iter); | |||||
gtk_list_store_set(pipelineConfigurationListStore, &iter, | |||||
Column_SettingPipelineId, static_cast<size_t>(pipelineID), | |||||
Column_SettingName, parameter.name.c_str(), | |||||
Column_SettingDefaultValue, parameter.defaultValue.c_str(), | |||||
Column_SettingValue, parameter.value.c_str(), | |||||
-1); | |||||
} | |||||
const auto savedSettings = m_Controller.getPipelineSettings(pipelineID); | |||||
const auto response = gtk_dialog_run(GTK_DIALOG(pipelineConfigurationWidget)); | |||||
if (response == GTK_RESPONSE_CANCEL) { m_Controller.getPipelineSettings(pipelineID) = savedSettings; } | |||||
} | |||||
bool CArchwayHandlerGUI::setPipelineParameterValueAtPath(gchar const* path, gchar const* value) | |||||
{ | |||||
const auto pipelineConfigurationListStore = | |||||
GTK_TREE_MODEL(gtk_builder_get_object(this->m_Builder, "liststore-pipeline-configuration")); | |||||
GtkTreeIter iter; | |||||
gboolean valid = gtk_tree_model_get_iter_from_string(pipelineConfigurationListStore, &iter, path); | |||||
assert(valid); | |||||
size_t id = 0; | |||||
gchar* name; | |||||
gtk_tree_model_get(pipelineConfigurationListStore, &iter, Column_SettingName, &name, -1); | |||||
gtk_tree_model_get(pipelineConfigurationListStore, &iter, Column_SettingPipelineId, &id, -1); | |||||
gtk_list_store_set(GTK_LIST_STORE(pipelineConfigurationListStore), &iter, Column_SettingValue, value, -1); | |||||
this->m_Controller.setPipelineParameterValue(size_t(id), name, value); | |||||
g_free(name); | |||||
return true; | |||||
} | |||||
} // namespace OpenViBE | |||||
#endif |
#pragma once | |||||
#ifdef MENSIA_DISTRIBUTION | |||||
#include "ovdCArchwayHandler.h" | |||||
#include <gtk/gtk.h> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CApplication; | |||||
} | |||||
} | |||||
namespace OpenViBE { | |||||
class CArchwayHandlerGUI final | |||||
{ | |||||
public: | |||||
CArchwayHandlerGUI(CArchwayHandler& controller, Designer::CApplication* application); | |||||
~CArchwayHandlerGUI(); | |||||
void refreshEnginePipelines(); | |||||
void toggleNeuroRTEngineConfigurationDialog(const bool shouldDisplay); | |||||
void displayPipelineConfigurationDialog(const size_t pipelineID); | |||||
bool setPipelineParameterValueAtPath(gchar const* path, gchar const* value); | |||||
GtkBuilder* m_Builder = nullptr; | |||||
GtkBuilder* m_ApplicationBuilder = nullptr; | |||||
CArchwayHandler& m_Controller; | |||||
Designer::CApplication* m_Application = nullptr; | |||||
// This variable is used to store the path of an edited cell | |||||
// while editing the PipelineParameters. | |||||
std::string m_CurrentlyEditedCellPath; | |||||
GtkWidget* m_ButtonOpenEngineConfigurationDialog = nullptr; | |||||
GtkWidget* m_ButtonConfigureAcquisition = nullptr; | |||||
GtkToggleToolButton* m_ToggleAcquireImpedance = nullptr; | |||||
GtkComboBox* m_ComboBoxEngineType = nullptr; | |||||
GtkWidget* m_ButtonReinitializeArchway = nullptr; | |||||
GtkWidget* m_ButtonLaunchEngine = nullptr; | |||||
GtkWidget* m_ButtonStartEngine = nullptr; | |||||
GtkWidget* m_ButtonStartEngineFastFoward = nullptr; | |||||
GtkWidget* m_ButtonStopEngine = nullptr; | |||||
GtkWidget* m_TreeViewEnginePipelines = nullptr; | |||||
GtkSpinner* m_SpinnerEngineActivity = nullptr; | |||||
GtkTreeModel* m_TreeModelEnginePipelines = nullptr; | |||||
GtkTreeIter m_SelectedPipelineIter; | |||||
}; | |||||
} | |||||
#endif |
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void CollectWidgetCB(GtkWidget* widget, gpointer data) { static_cast<std::vector<GtkWidget*>*>(data)->push_back(widget); } | |||||
CAbstractSettingView::~CAbstractSettingView() | |||||
{ | |||||
if (GTK_IS_WIDGET(m_nameWidget)) { gtk_widget_destroy(m_nameWidget); } | |||||
if (GTK_IS_WIDGET(m_entryNameWidget)) { gtk_widget_destroy(m_entryNameWidget); } | |||||
if (G_IS_OBJECT(m_builder)) { g_object_unref(m_builder); } | |||||
} | |||||
CAbstractSettingView::CAbstractSettingView(Kernel::IBox& box, const size_t index, const char* builderName, const char* widgetName) | |||||
: m_box(box), m_index(index), m_settingWidgetName("") | |||||
{ | |||||
if (builderName != nullptr) | |||||
{ | |||||
m_builder = gtk_builder_new(); | |||||
gtk_builder_add_from_file(m_builder, builderName, nullptr); | |||||
gtk_builder_connect_signals(m_builder, nullptr); | |||||
if (widgetName != nullptr) | |||||
{ | |||||
m_settingWidgetName = widgetName; | |||||
CAbstractSettingView::generateNameWidget(); | |||||
m_entryFieldWidget = CAbstractSettingView::generateEntryWidget(); | |||||
} | |||||
} | |||||
} | |||||
void CAbstractSettingView::setNameWidget(GtkWidget* widget) | |||||
{ | |||||
if (m_nameWidget) { gtk_widget_destroy(m_nameWidget); } | |||||
m_nameWidget = widget; | |||||
} | |||||
void CAbstractSettingView::setEntryWidget(GtkWidget* widget) | |||||
{ | |||||
if (m_entryNameWidget) { gtk_widget_destroy(m_entryNameWidget); } | |||||
m_entryNameWidget = widget; | |||||
} | |||||
void CAbstractSettingView::generateNameWidget() | |||||
{ | |||||
GtkWidget* settingName = GTK_WIDGET(gtk_builder_get_object(m_builder, "settings_collection-label_setting_name")); | |||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(settingName)), settingName); | |||||
setNameWidget(settingName); | |||||
CString name; | |||||
getBox().getSettingName(m_index, name); | |||||
gtk_label_set_text(GTK_LABEL(settingName), name); | |||||
} | |||||
GtkWidget* CAbstractSettingView::generateEntryWidget() | |||||
{ | |||||
GtkTable* table = GTK_TABLE(gtk_table_new(1, 3, false)); | |||||
GtkWidget* settingWidget = GTK_WIDGET(gtk_builder_get_object(m_builder, m_settingWidgetName.toASCIIString())); | |||||
GtkWidget* settingRevert = GTK_WIDGET(gtk_builder_get_object(m_builder, "settings_collection-button_setting_revert")); | |||||
GtkWidget* settingDefault = GTK_WIDGET(gtk_builder_get_object(m_builder, "settings_collection-button_setting_default")); | |||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(settingWidget)), settingWidget); | |||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(settingRevert)), settingRevert); | |||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(settingDefault)), settingDefault); | |||||
gtk_table_attach(table, settingWidget, 0, 1, 0, 1, GtkAttachOptions(GTK_FILL | GTK_EXPAND), GtkAttachOptions(GTK_FILL | GTK_EXPAND), 0, 0); | |||||
//gtk_table_attach(m_table, settingDefault, 1, 2, 0, 1, GtkAttachOptions(GTK_SHRINK), GtkAttachOptions(GTK_SHRINK), 0, 0); | |||||
//gtk_table_attach(m_table, settingRevert, 2, 3, 0, 1, GtkAttachOptions(GTK_SHRINK), GtkAttachOptions(GTK_SHRINK), 0, 0); | |||||
setEntryWidget(GTK_WIDGET(table)); | |||||
gtk_widget_set_visible(getEntryWidget(), true); | |||||
//If we don't increase the ref counter it will cause trouble when we gonna move it later | |||||
g_object_ref(G_OBJECT(table)); | |||||
return settingWidget; | |||||
} | |||||
void CAbstractSettingView::initializeValue() | |||||
{ | |||||
CString value; | |||||
getBox().getSettingValue(m_index, value); | |||||
setValue(value); | |||||
} | |||||
void CAbstractSettingView::extractWidget(GtkWidget* widget, std::vector<GtkWidget*>& widgets) | |||||
{ | |||||
gtk_container_foreach(GTK_CONTAINER(widget), CollectWidgetCB, &widgets); | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include <cstdlib> // size_t for unix | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CAbstractSettingView | |||||
{ | |||||
public: | |||||
virtual ~CAbstractSettingView(); | |||||
//Store the value of the setting in value | |||||
virtual void getValue(CString& value) const = 0; | |||||
//Set the view with the value contains in value | |||||
virtual void setValue(const CString& value) = 0; | |||||
//Get the label which contains the name of the setting | |||||
virtual GtkWidget* getNameWidget() { return m_nameWidget; } | |||||
//Get the table of widget which display the value of the setting (the entry and all interaction buttons) | |||||
virtual GtkWidget* getEntryWidget() { return m_entryNameWidget; } | |||||
//This function is use to update the setting index when a setting is suppressed or inserted | |||||
virtual void setSettingIndex(const size_t index) { m_index = index; } | |||||
//Get the index of the setting | |||||
virtual size_t getSettingIndex() { return m_index; } | |||||
protected: | |||||
//Initialize the common part of all view. If builderName and widgetName are not nullptr, the entryTable and the label | |||||
//will be set according to these informations. | |||||
//If there are nullptr, name and entry widget will have to be set after with corresponding setter. | |||||
CAbstractSettingView(Kernel::IBox& box, const size_t index, const char* builderName, const char* widgetName); | |||||
//Return the box which contains the setting | |||||
virtual Kernel::IBox& getBox() { return m_box; } | |||||
//Set the widget as the new widget name | |||||
virtual void setNameWidget(GtkWidget* widget); | |||||
//Set the widget as the new widget name | |||||
virtual void setEntryWidget(GtkWidget* widget); | |||||
//Set the setting view with the current value of the setting | |||||
virtual void initializeValue(); | |||||
//Return a vector which contains the list of the widget contains int the widget widget | |||||
virtual void extractWidget(GtkWidget* widget, std::vector<GtkWidget*>& widgets); | |||||
//Return the part of the entry table which is not revert or default button | |||||
virtual GtkWidget* getEntryFieldWidget() { return m_entryFieldWidget; } | |||||
private: | |||||
//Generate the label of the setting | |||||
virtual void generateNameWidget(); | |||||
//Generate the table of widget which display the value of the setting (the entry and all interaction buttons) | |||||
virtual GtkWidget* generateEntryWidget(); | |||||
Kernel::IBox& m_box; | |||||
size_t m_index = 0; | |||||
CString m_settingWidgetName; | |||||
GtkWidget* m_nameWidget = nullptr; | |||||
GtkWidget* m_entryNameWidget = nullptr; | |||||
GtkWidget* m_entryFieldWidget = nullptr; | |||||
//If we don't store the builder, the setting name will be free when we'll unref the builder | |||||
GtkBuilder* m_builder = nullptr; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCBitMaskSettingView.h" | |||||
#include "../ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnCheckbuttonPressed(GtkToggleButton* /*button*/, gpointer data) { static_cast<CBitMaskSettingView*>(data)->onChange(); } | |||||
CBitMaskSettingView::CBitMaskSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx, | |||||
const CIdentifier& typeID) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-table_setting_bitmask"), m_typeID(typeID), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
const gint tableSize = guint((m_kernelCtx.getTypeManager().getBitMaskEntryCount(m_typeID) + 1) >> 1); | |||||
GtkTable* bitMaskTable = GTK_TABLE(settingWidget); | |||||
gtk_table_resize(bitMaskTable, 2, tableSize); | |||||
for (size_t i = 0; i < m_kernelCtx.getTypeManager().getBitMaskEntryCount(m_typeID); ++i) | |||||
{ | |||||
CString name; | |||||
uint64_t value; | |||||
if (m_kernelCtx.getTypeManager().getBitMaskEntry(m_typeID, i, name, value)) | |||||
{ | |||||
GtkWidget* button = gtk_check_button_new(); | |||||
gtk_table_attach_defaults(bitMaskTable, button, guint(i & 1), guint((i & 1) + 1), guint(i >> 1), guint((i >> 1) + 1)); | |||||
gtk_button_set_label(GTK_BUTTON(button), name.toASCIIString()); | |||||
m_toggleButton.push_back(GTK_TOGGLE_BUTTON(button)); | |||||
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(OnCheckbuttonPressed), this); | |||||
} | |||||
} | |||||
gtk_widget_show_all(GTK_WIDGET(bitMaskTable)); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CBitMaskSettingView::getValue(CString& value) const | |||||
{ | |||||
std::string res; | |||||
for (auto& toggle : m_toggleButton) | |||||
{ | |||||
if (gtk_toggle_button_get_active(toggle)) | |||||
{ | |||||
if (!res.empty()) { res += ':'; } | |||||
res += gtk_button_get_label(GTK_BUTTON(toggle)); | |||||
} | |||||
} | |||||
value = res.c_str(); | |||||
} | |||||
void CBitMaskSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
const std::string str(value); | |||||
for (auto& toggle : m_toggleButton) | |||||
{ | |||||
const gchar* label = gtk_button_get_label(GTK_BUTTON(toggle)); | |||||
if (str.find(label) != std::string::npos) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), true); } | |||||
else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), false); } | |||||
} | |||||
m_onValueSetting = false; | |||||
} | |||||
void CBitMaskSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
CString value; | |||||
this->getValue(value); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
#include <vector> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CBitMaskSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CBitMaskSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx, const CIdentifier& typeID); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void onChange(); | |||||
private: | |||||
CIdentifier m_typeID = CIdentifier::undefined(); | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
std::vector<GtkToggleButton*> m_toggleButton; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCBooleanSettingView.h" | |||||
#include "../ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnCheckbuttonSettingBooleanPressed(GtkToggleButton* /*button*/, gpointer data) { static_cast<CBooleanSettingView*>(data)->toggleButtonClick(); } | |||||
static void OnInsertion(GtkEntry* /*entry*/, gpointer data) { static_cast<CBooleanSettingView*>(data)->onChange(); } | |||||
CBooleanSettingView::CBooleanSettingView(Kernel::IBox& box, const size_t index, CString& builderName) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_boolean") | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_toggle = GTK_TOGGLE_BUTTON(widgets[1]); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnInsertion), this); | |||||
g_signal_connect(G_OBJECT(m_toggle), "toggled", G_CALLBACK(OnCheckbuttonSettingBooleanPressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CBooleanSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CBooleanSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
if (value == CString("true")) | |||||
{ | |||||
gtk_toggle_button_set_active(m_toggle, true); | |||||
gtk_toggle_button_set_inconsistent(m_toggle, false); | |||||
} | |||||
else if (value == CString("false")) | |||||
{ | |||||
gtk_toggle_button_set_active(m_toggle, false); | |||||
gtk_toggle_button_set_inconsistent(m_toggle, false); | |||||
} | |||||
else { gtk_toggle_button_set_inconsistent(m_toggle, true); } | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CBooleanSettingView::toggleButtonClick() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
if (gtk_toggle_button_get_active(m_toggle)) | |||||
{ | |||||
getBox().setSettingValue(getSettingIndex(), "true"); | |||||
setValue("true"); | |||||
} | |||||
else | |||||
{ | |||||
getBox().setSettingValue(getSettingIndex(), "false"); | |||||
setValue("false"); | |||||
} | |||||
} | |||||
} | |||||
void CBooleanSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CBooleanSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CBooleanSettingView(Kernel::IBox& box, const size_t index, CString& builderName); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void toggleButtonClick(); | |||||
void onChange(); | |||||
private: | |||||
GtkToggleButton* m_toggle = nullptr; | |||||
GtkEntry* m_entry = nullptr; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCColorGradientSettingView.h" | |||||
#include "../ovd_base.h" | |||||
#include <visualization-toolkit/ovvizColorGradient.h> | |||||
#include <cmath> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnColorGradientColorButtonPressed(GtkColorButton* button, gpointer data) { static_cast<CColorGradientSettingView*>(data)->colorChange(button); } | |||||
static void OnButtonSettingColorGradientConfigurePressed(GtkButton* /*button*/, gpointer data) | |||||
{ | |||||
static_cast<CColorGradientSettingView*>(data)->configurePressed(); | |||||
} | |||||
static void OnRefreshColorGradient(GtkWidget* /*widget*/, GdkEventExpose* /*event*/, gpointer data) | |||||
{ | |||||
static_cast<CColorGradientSettingView*>(data)->refreshColorGradient(); | |||||
} | |||||
static void OnGTKWidgetDestroy(GtkWidget* widget, gpointer /*data*/) { gtk_widget_destroy(widget); } | |||||
static void OnInitializeColorGradient(GtkWidget* /*widget*/, gpointer data) { static_cast<CColorGradientSettingView*>(data)->initializeGradient(); } | |||||
static void OnButtonColorGradientAddPressed(GtkButton* /*button*/, gpointer data) { static_cast<CColorGradientSettingView*>(data)->addColor(); } | |||||
static void OnButtonColorGradientRemovePressed(GtkButton* /*button*/, gpointer data) { static_cast<CColorGradientSettingView*>(data)->removeColor(); } | |||||
static void OnColorGradientSpinButtonValueChanged(GtkSpinButton* button, gpointer data) { static_cast<CColorGradientSettingView*>(data)->spinChange(button); } | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CColorGradientSettingView*>(data)->onChange(); } | |||||
CColorGradientSettingView::CColorGradientSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_color_gradient"), m_kernelCtx(ctx), m_builderName(builderName) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnChange), this); | |||||
g_signal_connect(G_OBJECT(widgets[1]), "clicked", G_CALLBACK(OnButtonSettingColorGradientConfigurePressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CColorGradientSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CColorGradientSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CColorGradientSettingView::configurePressed() | |||||
{ | |||||
GtkBuilder* builder = gtk_builder_new(); | |||||
gtk_builder_add_from_file(builder, m_builderName.toASCIIString(), nullptr); | |||||
gtk_builder_connect_signals(builder, nullptr); | |||||
m_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "setting_editor-color_gradient-dialog")); | |||||
const CString initialGradient = m_kernelCtx.getConfigurationManager().expand(gtk_entry_get_text(m_entry)); | |||||
CMatrix colorGradient; | |||||
VisualizationToolkit::ColorGradient::parse(colorGradient, initialGradient); | |||||
m_colorGradient.resize(std::max<size_t>(colorGradient.getDimensionSize(1), 2)); | |||||
for (size_t i = 0; i < colorGradient.getDimensionSize(1); ++i) | |||||
{ | |||||
const size_t idx = i * 4; | |||||
m_colorGradient[i].percent = colorGradient[idx]; | |||||
m_colorGradient[i].color.red = guint(colorGradient[idx + 1] * .01 * 65535.); | |||||
m_colorGradient[i].color.green = guint(colorGradient[idx + 2] * .01 * 65535.); | |||||
m_colorGradient[i].color.blue = guint(colorGradient[idx + 3] * .01 * 65535.); | |||||
} | |||||
m_container = GTK_WIDGET(gtk_builder_get_object(builder, "setting_editor-color_gradient-vbox")); | |||||
m_drawingArea = GTK_WIDGET(gtk_builder_get_object(builder, "setting_editor-color_gradient-drawingarea")); | |||||
g_signal_connect(G_OBJECT(m_dialog), "show", G_CALLBACK(OnInitializeColorGradient), this); | |||||
g_signal_connect(G_OBJECT(m_drawingArea), "expose_event", G_CALLBACK(OnRefreshColorGradient), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(builder, "setting_editor-color_gradient-add_button")), "pressed", | |||||
G_CALLBACK(OnButtonColorGradientAddPressed), this); | |||||
g_signal_connect(G_OBJECT(gtk_builder_get_object(builder, "setting_editor-color_gradient-remove_button")), "pressed", | |||||
G_CALLBACK(OnButtonColorGradientRemovePressed), this); | |||||
if (gtk_dialog_run(GTK_DIALOG(m_dialog)) == GTK_RESPONSE_APPLY) | |||||
{ | |||||
CString finalGradient; | |||||
CMatrix finalColorGradient(4, m_colorGradient.size()); | |||||
size_t idx = 0; | |||||
for (size_t i = 0; i < m_colorGradient.size(); ++i) | |||||
{ | |||||
finalColorGradient[idx++] = m_colorGradient[i].percent; | |||||
finalColorGradient[idx++] = round(m_colorGradient[i].color.red * 100. / 65535.); | |||||
finalColorGradient[idx++] = round(m_colorGradient[i].color.green * 100. / 65535.); | |||||
finalColorGradient[idx++] = round(m_colorGradient[i].color.blue * 100. / 65535.); | |||||
} | |||||
VisualizationToolkit::ColorGradient::format(finalGradient, finalColorGradient); | |||||
if (!m_onValueSetting) { getBox().setSettingValue(getSettingIndex(), finalGradient.toASCIIString()); } | |||||
setValue(finalGradient.toASCIIString()); | |||||
} | |||||
gtk_widget_destroy(m_dialog); | |||||
g_object_unref(builder); | |||||
} | |||||
void CColorGradientSettingView::initializeGradient() | |||||
{ | |||||
gtk_widget_hide(m_container); | |||||
gtk_container_foreach(GTK_CONTAINER(m_container), OnGTKWidgetDestroy, nullptr); | |||||
size_t i = 0; | |||||
const size_t count = m_colorGradient.size(); | |||||
m_colorButtons.clear(); | |||||
m_spinButtons.clear(); | |||||
for (auto& cg : m_colorGradient) | |||||
{ | |||||
GtkBuilder* builder = gtk_builder_new(); | |||||
gtk_builder_add_from_file(builder, m_builderName.toASCIIString(), nullptr); | |||||
gtk_builder_connect_signals(builder, nullptr); | |||||
GtkWidget* widget = GTK_WIDGET(gtk_builder_get_object(builder, "setting_editor-color_gradient-hbox")); | |||||
cg.colorButton = GTK_COLOR_BUTTON(gtk_builder_get_object(builder, "setting_editor-color_gradient-colorbutton")); | |||||
cg.spinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "setting_editor-color_gradient-spinbutton")); | |||||
gtk_color_button_set_color(cg.colorButton, &cg.color); | |||||
gtk_spin_button_set_value(cg.spinButton, cg.percent); | |||||
g_signal_connect(G_OBJECT(cg.colorButton), "color-set", G_CALLBACK(OnColorGradientColorButtonPressed), this); | |||||
g_signal_connect(G_OBJECT(cg.spinButton), "value-changed", G_CALLBACK(OnColorGradientSpinButtonValueChanged), this); | |||||
g_object_ref(widget); | |||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget); | |||||
gtk_container_add(GTK_CONTAINER(m_container), widget); | |||||
g_object_unref(widget); | |||||
g_object_unref(builder); | |||||
m_colorButtons[cg.colorButton] = i; | |||||
m_spinButtons[cg.spinButton] = i; | |||||
i++; | |||||
} | |||||
gtk_spin_button_set_value(m_colorGradient[0].spinButton, 0); | |||||
gtk_spin_button_set_value(m_colorGradient[count - 1].spinButton, 100); | |||||
gtk_widget_show(m_container); | |||||
} | |||||
void CColorGradientSettingView::refreshColorGradient() | |||||
{ | |||||
const size_t steps = 100; | |||||
gint sizex = 0; | |||||
gint sizey = 0; | |||||
gdk_drawable_get_size(m_drawingArea->window, &sizex, &sizey); | |||||
CMatrix gradient(4, m_colorGradient.size()); | |||||
for (size_t i = 0; i < m_colorGradient.size(); ++i) | |||||
{ | |||||
const size_t idx = i * 4; | |||||
gradient[idx] = m_colorGradient[i].percent; | |||||
gradient[idx + 1] = m_colorGradient[i].color.red * 100. / 65535.; | |||||
gradient[idx + 2] = m_colorGradient[i].color.green * 100. / 65535.; | |||||
gradient[idx + 3] = m_colorGradient[i].color.blue * 100. / 65535.; | |||||
} | |||||
CMatrix interpolated; | |||||
VisualizationToolkit::ColorGradient::interpolate(interpolated, gradient, steps); | |||||
GdkGC* gc = gdk_gc_new(m_drawingArea->window); | |||||
GdkColor color; | |||||
for (size_t i = 0; i < steps; ++i) | |||||
{ | |||||
color.red = guint(interpolated[i * 4 + 1] * 65535 * .01); | |||||
color.green = guint(interpolated[i * 4 + 2] * 65535 * .01); | |||||
color.blue = guint(interpolated[i * 4 + 3] * 65535 * .01); | |||||
gdk_gc_set_rgb_fg_color(gc, &color); | |||||
gdk_draw_rectangle(m_drawingArea->window, gc, TRUE, gint((sizex * i) / steps), 0, gint((sizex * (i + 1)) / steps), sizey); | |||||
} | |||||
g_object_unref(gc); | |||||
} | |||||
void CColorGradientSettingView::addColor() | |||||
{ | |||||
m_colorGradient.resize(m_colorGradient.size() + 1); | |||||
m_colorGradient[m_colorGradient.size() - 1].percent = 100; | |||||
initializeGradient(); | |||||
refreshColorGradient(); | |||||
} | |||||
void CColorGradientSettingView::removeColor() | |||||
{ | |||||
if (m_colorGradient.size() > 2) | |||||
{ | |||||
m_colorGradient.resize(m_colorGradient.size() - 1); | |||||
m_colorGradient[m_colorGradient.size() - 1].percent = 100; | |||||
initializeGradient(); | |||||
refreshColorGradient(); | |||||
} | |||||
} | |||||
void CColorGradientSettingView::spinChange(GtkSpinButton* button) | |||||
{ | |||||
gtk_spin_button_update(button); | |||||
const size_t i = m_spinButtons[button]; | |||||
GtkSpinButton* prevSpinButton = i > 0 ? m_colorGradient[i - 1].spinButton : nullptr; | |||||
GtkSpinButton* nextSpinButton = i < m_colorGradient.size() - 1 ? m_colorGradient[i + 1].spinButton : nullptr; | |||||
if (!prevSpinButton) { gtk_spin_button_set_value(button, 0); } | |||||
if (!nextSpinButton) { gtk_spin_button_set_value(button, 100); } | |||||
if (prevSpinButton && gtk_spin_button_get_value(button) < gtk_spin_button_get_value(prevSpinButton)) | |||||
{ | |||||
gtk_spin_button_set_value(button, gtk_spin_button_get_value(prevSpinButton)); | |||||
} | |||||
if (nextSpinButton && gtk_spin_button_get_value(button) > gtk_spin_button_get_value(nextSpinButton)) | |||||
{ | |||||
gtk_spin_button_set_value(button, gtk_spin_button_get_value(nextSpinButton)); | |||||
} | |||||
m_colorGradient[i].percent = gtk_spin_button_get_value(button); | |||||
refreshColorGradient(); | |||||
} | |||||
void CColorGradientSettingView::colorChange(GtkColorButton* button) | |||||
{ | |||||
GdkColor color; | |||||
gtk_color_button_get_color(button, &color); | |||||
m_colorGradient[m_colorButtons[button]].color = color; | |||||
refreshColorGradient(); | |||||
} | |||||
void CColorGradientSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
#include <string> | |||||
#include <map> | |||||
#include <vector> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
typedef struct | |||||
{ | |||||
double percent; | |||||
GdkColor color; | |||||
GtkColorButton* colorButton; | |||||
GtkSpinButton* spinButton; | |||||
} color_gradient_data_node_t; | |||||
class CColorGradientSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CColorGradientSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void configurePressed(); | |||||
void initializeGradient(); | |||||
void refreshColorGradient(); | |||||
void addColor(); | |||||
void removeColor(); | |||||
void spinChange(GtkSpinButton* button); | |||||
void colorChange(GtkColorButton* button); | |||||
void onChange(); | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
CString m_builderName; | |||||
GtkWidget* m_dialog = nullptr; | |||||
GtkWidget* m_container = nullptr; | |||||
GtkWidget* m_drawingArea = nullptr; | |||||
std::vector<color_gradient_data_node_t> m_colorGradient; | |||||
std::map<GtkColorButton*, size_t> m_colorButtons; | |||||
std::map<GtkSpinButton*, size_t> m_spinButtons; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCColorSettingView.h" | |||||
#include "../ovd_base.h" | |||||
#include <cmath> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static int Color2Percent(const guint16 color) { return int(round(color / 655.350)); } // c * 100 / 65535 | |||||
static guint16 Percent2Color(const int color) { return guint16(color * 655.35); } // c * 65535 / 100 | |||||
static void OnButtonSettingColorChoosePressed(GtkColorButton* /*button*/, gpointer data) { static_cast<CColorSettingView*>(data)->selectColor(); } | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CColorSettingView*>(data)->onChange(); } | |||||
CColorSettingView::CColorSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_color"), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
m_button = GTK_COLOR_BUTTON(widgets[1]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnChange), this); | |||||
g_signal_connect(G_OBJECT(m_button), "color-set", G_CALLBACK(OnButtonSettingColorChoosePressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CColorSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CColorSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
int r = 0, g = 0, b = 0; | |||||
sscanf(m_kernelCtx.getConfigurationManager().expand(value).toASCIIString(), "%i,%i,%i", &r, &g, &b); | |||||
GdkColor color; | |||||
color.red = Percent2Color(r); | |||||
color.green = Percent2Color(g); | |||||
color.blue = Percent2Color(b); | |||||
gtk_color_button_set_color(m_button, &color); | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CColorSettingView::selectColor() | |||||
{ | |||||
GdkColor color; | |||||
gtk_color_button_get_color(m_button, &color); | |||||
const std::string value = std::to_string(Color2Percent(color.red)) + "," + std::to_string(Color2Percent(color.green)) + "," | |||||
+ std::to_string(Color2Percent(color.blue)); | |||||
getBox().setSettingValue(getSettingIndex(), value.c_str()); | |||||
setValue(value.c_str()); | |||||
} | |||||
void CColorSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CColorSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CColorSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void selectColor(); | |||||
void onChange(); | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
GtkColorButton* m_button = nullptr; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCEnumerationSettingView.h" | |||||
#include "../ovd_base.h" | |||||
#include <algorithm> // std::sort | |||||
#include <map> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CEnumerationSettingView*>(data)->onChange(); } | |||||
CEnumerationSettingView::CEnumerationSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx, | |||||
const CIdentifier& typeID) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-comboboxentry_setting_enumeration"), m_typeID(typeID), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* setting = CAbstractSettingView::getEntryFieldWidget(); | |||||
m_comboBox = GTK_COMBO_BOX(setting); | |||||
std::vector<std::string> entries; | |||||
for (size_t i = 0; i < m_kernelCtx.getTypeManager().getEnumerationEntryCount(m_typeID); ++i) | |||||
{ | |||||
CString name; | |||||
uint64_t value; | |||||
if (m_kernelCtx.getTypeManager().getEnumerationEntry(m_typeID, i, name, value)) { entries.push_back(name.toASCIIString()); } | |||||
} | |||||
std::sort(entries.begin(), entries.end()); | |||||
GtkTreeIter it; | |||||
GtkListStore* list = GTK_LIST_STORE(gtk_combo_box_get_model(m_comboBox)); | |||||
gtk_combo_box_set_wrap_width(m_comboBox, 0); | |||||
gtk_list_store_clear(list); | |||||
for (size_t i = 0; i < entries.size(); ++i) | |||||
{ | |||||
gtk_list_store_append(list, &it); | |||||
gtk_list_store_set(list, &it, 0, entries[i].c_str(), -1); | |||||
m_entriesIdx[CString(entries[i].c_str())] = uint64_t(i); | |||||
} | |||||
CString value; | |||||
box.getSettingValue(index, value); | |||||
if (m_entriesIdx.count(value.toASCIIString()) == 0) | |||||
{ | |||||
gtk_list_store_append(list, &it); | |||||
gtk_list_store_set(list, &it, 0, value.toASCIIString(), -1); | |||||
} | |||||
CAbstractSettingView::initializeValue(); | |||||
g_signal_connect(G_OBJECT(m_comboBox), "changed", G_CALLBACK(OnChange), this); | |||||
} | |||||
void CEnumerationSettingView::getValue(CString& value) const { value = CString(gtk_combo_box_get_active_text(m_comboBox)); } | |||||
void CEnumerationSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
// If the current value of the setting is not in the enumeration list, we will add or replace the last value in the list, so it can be set to this value | |||||
if (m_entriesIdx.count(value) == 0) | |||||
{ | |||||
GtkTreeIter it; | |||||
GtkListStore* list = GTK_LIST_STORE(gtk_combo_box_get_model(m_comboBox)); | |||||
int valuesInModel = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(list), nullptr); | |||||
if (valuesInModel == int(m_entriesIdx.size())) | |||||
{ | |||||
gtk_list_store_append(list, &it); | |||||
valuesInModel += 1; | |||||
} | |||||
else | |||||
{ | |||||
// We just set the iterator at the end | |||||
GtkTreePath* treePath = gtk_tree_path_new_from_indices(valuesInModel - 1, -1); | |||||
gtk_tree_model_get_iter(GTK_TREE_MODEL(list), &it, treePath); | |||||
gtk_tree_path_free(treePath); | |||||
} | |||||
gtk_list_store_set(list, &it, 0, value.toASCIIString(), -1); | |||||
gtk_combo_box_set_active(m_comboBox, valuesInModel - 1); | |||||
} | |||||
else { gtk_combo_box_set_active(m_comboBox, gint(m_entriesIdx[value])); } | |||||
m_onValueSetting = false; | |||||
} | |||||
void CEnumerationSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
gchar* value = gtk_combo_box_get_active_text(m_comboBox); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
g_free(value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
#include <map> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CEnumerationSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CEnumerationSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx, const CIdentifier& typeID); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void onChange(); | |||||
private: | |||||
GtkComboBox* m_comboBox = nullptr; | |||||
CIdentifier m_typeID = CIdentifier::undefined(); | |||||
std::map<CString, size_t> m_entriesIdx; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCFilenameSettingView.h" | |||||
#include "../ovd_base.h" | |||||
#include <cstring> | |||||
#include <iterator> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnButtonSettingFilenameBrowsePressed(GtkButton* /*button*/, gpointer data) { static_cast<CFilenameSettingView*>(data)->browse(); } | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CFilenameSettingView*>(data)->onChange(); } | |||||
#if defined TARGET_OS_Windows | |||||
static gboolean OnFocusOutEvent(GtkEntry* /*entry*/, GdkEvent* /*event*/, gpointer data) | |||||
{ | |||||
static_cast<CFilenameSettingView*>(data)->onFocusLost(); | |||||
return FALSE; | |||||
} | |||||
#endif | |||||
CFilenameSettingView::CFilenameSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_filename"), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnChange), this); | |||||
#if defined TARGET_OS_Windows | |||||
// Only called for Windows path | |||||
g_signal_connect(G_OBJECT(m_entry), "focus_out_event", G_CALLBACK(OnFocusOutEvent), this); | |||||
#endif | |||||
g_signal_connect(G_OBJECT(widgets[1]), "clicked", G_CALLBACK(OnButtonSettingFilenameBrowsePressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CFilenameSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CFilenameSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CFilenameSettingView::browse() const | |||||
{ | |||||
GtkWidget* widgetDialogOpen = gtk_file_chooser_dialog_new("Select file to open...", nullptr, GTK_FILE_CHOOSER_ACTION_SAVE, | |||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, nullptr); | |||||
const CString initialFilename = m_kernelCtx.getConfigurationManager().expand(gtk_entry_get_text(m_entry)); | |||||
if (g_path_is_absolute(initialFilename.toASCIIString())) | |||||
{ | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), initialFilename.toASCIIString()); | |||||
} | |||||
else | |||||
{ | |||||
char* fullPath = g_build_filename(g_get_current_dir(), initialFilename.toASCIIString(), nullptr); | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), fullPath); | |||||
g_free(fullPath); | |||||
} | |||||
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(widgetDialogOpen), false); | |||||
if (gtk_dialog_run(GTK_DIALOG(widgetDialogOpen)) == GTK_RESPONSE_ACCEPT) | |||||
{ | |||||
char* fileName = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widgetDialogOpen)); | |||||
char* backslash; | |||||
while ((backslash = strchr(fileName, '\\')) != nullptr) { *backslash = '/'; } | |||||
gtk_entry_set_text(m_entry, fileName); | |||||
g_free(fileName); | |||||
} | |||||
gtk_widget_destroy(widgetDialogOpen); | |||||
} | |||||
void CFilenameSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
#if defined TARGET_OS_Windows | |||||
void CFilenameSettingView::onFocusLost() | |||||
{ | |||||
// We replace antislash, interpreted as escape, by slash in Windows path | |||||
if (!m_onValueSetting) | |||||
{ | |||||
std::string fileName = gtk_entry_get_text(m_entry); | |||||
auto it = fileName.begin(); | |||||
while ((it = std::find(it, fileName.end(), '\\')) != fileName.end()) | |||||
{ | |||||
if (it == std::prev(fileName.end())) | |||||
{ | |||||
*it = '/'; | |||||
break; | |||||
} | |||||
if (*std::next(it) != '{' && *std::next(it) != '$' && *std::next(it) != '}') { *it = '/'; } | |||||
std::advance(it, 1); | |||||
} | |||||
gtk_entry_set_text(m_entry, fileName.c_str()); | |||||
getBox().setSettingValue(this->getSettingIndex(), fileName.c_str()); | |||||
} | |||||
} | |||||
#endif | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CFilenameSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CFilenameSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void browse() const; | |||||
void onChange(); | |||||
#if defined TARGET_OS_Windows | |||||
void onFocusLost(); | |||||
#endif | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCFloatSettingView.h" | |||||
#include "../ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnButtonSettingFloatUpPressed(GtkButton* /*button*/, gpointer data) { static_cast<CFloatSettingView*>(data)->adjustValue(1.0); } | |||||
static void OnButtonSettingFloatDownPressed(GtkButton* /*button*/, gpointer data) { static_cast<CFloatSettingView*>(data)->adjustValue(-1.0); } | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CFloatSettingView*>(data)->onChange(); } | |||||
CFloatSettingView::CFloatSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_float"), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnChange), this); | |||||
g_signal_connect(G_OBJECT(widgets[1]), "clicked", G_CALLBACK(OnButtonSettingFloatUpPressed), this); | |||||
g_signal_connect(G_OBJECT(widgets[2]), "clicked", G_CALLBACK(OnButtonSettingFloatDownPressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CFloatSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CFloatSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CFloatSettingView::adjustValue(const double amount) | |||||
{ | |||||
const double value = m_kernelCtx.getConfigurationManager().expandAsFloat(gtk_entry_get_text(m_entry), 0) + amount; | |||||
const std::string str = std::to_string(value); | |||||
getBox().setSettingValue(getSettingIndex(), str.c_str()); | |||||
setValue(str.c_str()); | |||||
} | |||||
void CFloatSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CFloatSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CFloatSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void adjustValue(double amount); | |||||
void onChange(); | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCIntegerSettingView.h" | |||||
#include "../ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnButtonSettingIntegerUpPressed(GtkButton* /*button*/, gpointer data) { static_cast<CIntegerSettingView*>(data)->adjustValue(1); } | |||||
static void OnButtonSettingIntegerDownPressed(GtkButton* /*button*/, gpointer data) { static_cast<CIntegerSettingView*>(data)->adjustValue(-1); } | |||||
static void OnInsertion(GtkEntry* /*entry*/, gpointer data) { static_cast<CIntegerSettingView*>(data)->onChange(); } | |||||
CIntegerSettingView::CIntegerSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_integer"), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnInsertion), this); | |||||
g_signal_connect(G_OBJECT(widgets[1]), "clicked", G_CALLBACK(OnButtonSettingIntegerUpPressed), this); | |||||
g_signal_connect(G_OBJECT(widgets[2]), "clicked", G_CALLBACK(OnButtonSettingIntegerDownPressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CIntegerSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CIntegerSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CIntegerSettingView::adjustValue(const int amount) | |||||
{ | |||||
const int64_t value = m_kernelCtx.getConfigurationManager().expandAsInteger(gtk_entry_get_text(m_entry), 0) + amount; | |||||
const std::string res = std::to_string(value); | |||||
getBox().setSettingValue(getSettingIndex(), res.c_str()); | |||||
setValue(res.c_str()); | |||||
} | |||||
void CIntegerSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CIntegerSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CIntegerSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void adjustValue(int amount); | |||||
void onChange(); | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCScriptSettingView.h" | |||||
#include "../ovd_base.h" | |||||
#include <cstring> | |||||
#include <cstdlib> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnButtonSettingFilenameBrowsePressed(GtkButton* /*button*/, gpointer data) { static_cast<CScriptSettingView*>(data)->browse(); } | |||||
static void OnButtonSettingScriptEditPressed(GtkButton* /*button*/, gpointer data) { static_cast<CScriptSettingView*>(data)->edit(); } | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CScriptSettingView*>(data)->onChange(); } | |||||
#if defined TARGET_OS_Windows | |||||
static gboolean OnFocusOutEvent(GtkEntry* /*entry*/, GdkEvent* /*event*/, gpointer data) | |||||
{ | |||||
static_cast<CScriptSettingView*>(data)->onFocusLost(); | |||||
return FALSE; | |||||
} | |||||
#endif | |||||
CScriptSettingView::CScriptSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-hbox_setting_script"), m_kernelCtx(ctx) | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
std::vector<GtkWidget*> widgets; | |||||
CAbstractSettingView::extractWidget(settingWidget, widgets); | |||||
m_entry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnChange), this); | |||||
#if defined TARGET_OS_Windows | |||||
// Only called for Windows path | |||||
g_signal_connect(G_OBJECT(m_entry), "focus_out_event", G_CALLBACK(OnFocusOutEvent), this); | |||||
#endif | |||||
g_signal_connect(G_OBJECT(widgets[1]), "clicked", G_CALLBACK(OnButtonSettingScriptEditPressed), this); | |||||
g_signal_connect(G_OBJECT(widgets[2]), "clicked", G_CALLBACK(OnButtonSettingFilenameBrowsePressed), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CScriptSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CScriptSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CScriptSettingView::browse() const | |||||
{ | |||||
GtkWidget* widgetDialogOpen = gtk_file_chooser_dialog_new("Select file to open...", nullptr, GTK_FILE_CHOOSER_ACTION_SAVE, | |||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, nullptr); | |||||
const CString initialFileName = m_kernelCtx.getConfigurationManager().expand(gtk_entry_get_text(m_entry)); | |||||
if (g_path_is_absolute(initialFileName.toASCIIString())) | |||||
{ | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), initialFileName.toASCIIString()); | |||||
} | |||||
else | |||||
{ | |||||
char* fullPath = g_build_filename(g_get_current_dir(), initialFileName.toASCIIString(), nullptr); | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), fullPath); | |||||
g_free(fullPath); | |||||
} | |||||
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(widgetDialogOpen), false); | |||||
if (gtk_dialog_run(GTK_DIALOG(widgetDialogOpen)) == GTK_RESPONSE_ACCEPT) | |||||
{ | |||||
char* fileName = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widgetDialogOpen)); | |||||
char* backslash; | |||||
while ((backslash = strchr(fileName, '\\')) != nullptr) { *backslash = '/'; } | |||||
gtk_entry_set_text(m_entry, fileName); | |||||
g_free(fileName); | |||||
} | |||||
gtk_widget_destroy(widgetDialogOpen); | |||||
} | |||||
void CScriptSettingView::edit() const | |||||
{ | |||||
const CString fileName = m_kernelCtx.getConfigurationManager().expand(gtk_entry_get_text(m_entry)); | |||||
const CString editorCmd = m_kernelCtx.getConfigurationManager().expand("${Designer_ScriptEditorCommand}"); | |||||
if (editorCmd != CString("")) | |||||
{ | |||||
CString fullCmd = editorCmd + CString(" \"") + fileName + CString("\""); | |||||
#if defined TARGET_OS_Windows | |||||
fullCmd = "START " + fullCmd; | |||||
#elif defined TARGET_OS_Linux | |||||
fullCmd = fullCmd + " &"; | |||||
#else | |||||
#endif | |||||
if (system(fullCmd.toASCIIString()) < 0) { m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Could not run command " << fullCmd << "\n"; } | |||||
} | |||||
} | |||||
void CScriptSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
#if defined TARGET_OS_Windows | |||||
void CScriptSettingView::onFocusLost() | |||||
{ | |||||
// We replace antislash, interpreted as escape, by slash in Windows path | |||||
if (!m_onValueSetting) | |||||
{ | |||||
std::string fileName = gtk_entry_get_text(m_entry); | |||||
auto it = fileName.begin(); | |||||
while ((it = std::find(it, fileName.end(), '\\')) != fileName.end()) | |||||
{ | |||||
if (it == std::prev(fileName.end())) | |||||
{ | |||||
*it = '/'; | |||||
break; | |||||
} | |||||
if (*std::next(it) != '{' && *std::next(it) != '$' && *std::next(it) != '}') { *it = '/'; } | |||||
std::advance(it, 1); | |||||
} | |||||
gtk_entry_set_text(m_entry, fileName.c_str()); | |||||
getBox().setSettingValue(this->getSettingIndex(), fileName.c_str()); | |||||
} | |||||
} | |||||
#endif | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CScriptSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CScriptSettingView(Kernel::IBox& box, const size_t index, CString& builderName, const Kernel::IKernelContext& ctx); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void browse() const; | |||||
void edit() const; | |||||
void onChange(); | |||||
#if defined TARGET_OS_Windows | |||||
void onFocusLost(); | |||||
#endif | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCSettingViewFactory.h" | |||||
#include "ovdCBooleanSettingView.h" | |||||
#include "ovdCIntegerSettingView.h" | |||||
#include "ovdCFloatSettingView.h" | |||||
#include "ovdCStringSettingView.h" | |||||
#include "ovdCFilenameSettingView.h" | |||||
#include "ovdCScriptSettingView.h" | |||||
#include "ovdCColorSettingView.h" | |||||
#include "ovdCColorGradientSettingView.h" | |||||
#include "ovdCEnumerationSettingView.h" | |||||
#include "ovdCBitMaskSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
CAbstractSettingView* CSettingViewFactory::getSettingView(Kernel::IBox& box, const size_t index) | |||||
{ | |||||
CIdentifier type; | |||||
box.getSettingType(index, type); | |||||
if (type == OV_TypeId_Boolean) { return new CBooleanSettingView(box, index, m_builderName); } | |||||
if (type == OV_TypeId_Integer) { return new CIntegerSettingView(box, index, m_builderName, m_kernelCtx); } | |||||
if (type == OV_TypeId_Float) { return new CFloatSettingView(box, index, m_builderName, m_kernelCtx); } | |||||
if (type == OV_TypeId_String) { return new CStringSettingView(box, index, m_builderName); } | |||||
if (type == OV_TypeId_Filename) { return new CFilenameSettingView(box, index, m_builderName, m_kernelCtx); } | |||||
if (type == OV_TypeId_Script) { return new CScriptSettingView(box, index, m_builderName, m_kernelCtx); } | |||||
if (type == OV_TypeId_Color) { return new CColorSettingView(box, index, m_builderName, m_kernelCtx); } | |||||
if (type == OV_TypeId_ColorGradient) { return new CColorGradientSettingView(box, index, m_builderName, m_kernelCtx); } | |||||
if (m_kernelCtx.getTypeManager().isEnumeration(type)) { return new CEnumerationSettingView(box, index, m_builderName, m_kernelCtx, type); } | |||||
if (m_kernelCtx.getTypeManager().isBitMask(type)) { return new CBitMaskSettingView(box, index, m_builderName, m_kernelCtx, type); } | |||||
//By default we consider every settings as a string | |||||
return new CStringSettingView(box, index, m_builderName); | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CSettingViewFactory final | |||||
{ | |||||
public: | |||||
CSettingViewFactory(const CString& builderName, const Kernel::IKernelContext& ctx) | |||||
: m_builderName(builderName), m_kernelCtx(ctx) { } | |||||
~CSettingViewFactory() = default; | |||||
CAbstractSettingView* getSettingView(Kernel::IBox& box, const size_t index); | |||||
private: | |||||
CString m_builderName; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCStringSettingView.h" | |||||
#include "../ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
static void OnChange(GtkEntry* /*entry*/, gpointer data) { static_cast<CStringSettingView*>(data)->onChange(); } | |||||
CStringSettingView::CStringSettingView(Kernel::IBox& box, const size_t index, CString& builderName) | |||||
: CAbstractSettingView(box, index, builderName, "settings_collection-entry_setting_string") | |||||
{ | |||||
GtkWidget* settingWidget = CAbstractSettingView::getEntryFieldWidget(); | |||||
m_entry = GTK_ENTRY(settingWidget); | |||||
g_signal_connect(G_OBJECT(m_entry), "changed", G_CALLBACK(OnChange), this); | |||||
CAbstractSettingView::initializeValue(); | |||||
} | |||||
void CStringSettingView::getValue(CString& value) const { value = CString(gtk_entry_get_text(m_entry)); } | |||||
void CStringSettingView::setValue(const CString& value) | |||||
{ | |||||
m_onValueSetting = true; | |||||
gtk_entry_set_text(m_entry, value); | |||||
m_onValueSetting = false; | |||||
} | |||||
void CStringSettingView::onChange() | |||||
{ | |||||
if (!m_onValueSetting) | |||||
{ | |||||
const gchar* value = gtk_entry_get_text(m_entry); | |||||
getBox().setSettingValue(getSettingIndex(), value); | |||||
} | |||||
} | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "../ovd_base.h" | |||||
#include "ovdCAbstractSettingView.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
namespace Setting { | |||||
class CStringSettingView final : public CAbstractSettingView | |||||
{ | |||||
public: | |||||
CStringSettingView(Kernel::IBox& box, const size_t index, CString& builderName); | |||||
void getValue(CString& value) const override; | |||||
void setValue(const CString& value) override; | |||||
void onChange(); | |||||
private: | |||||
GtkEntry* m_entry = nullptr; | |||||
bool m_onValueSetting = false; | |||||
}; | |||||
} // namespace Setting | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include <exception> | |||||
#include <stdexcept> | |||||
#include <fs/Files.h> | |||||
#include <openvibe/ovAssert.h> | |||||
#include <openvibe/kernel/error/ovIErrorManager.h> | |||||
#include <openvibe/kernel/error/ovIError.h> | |||||
#define OV_ERROR_D(description, type, returnValue) OV_ERROR(description, type, returnValue, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_DRF(description, type) OV_ERROR(description, type, false, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_DRZ(description, type) OV_ERROR(description, type, 0, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_DRU(description, type) OV_ERROR(description, type, CIdentifier::undefined(), m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_DRV(description, type) OV_ERROR(description, type, void(), m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_DRN(description, type) OV_ERROR(description, type, nullptr, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_UNLESS_D(expression, description, type, returnValue) OV_ERROR_UNLESS(expression, description, type, returnValue, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_UNLESS_DRF(expression, description, type) OV_ERROR_UNLESS(expression, description, type, false, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_UNLESS_DRZ(expression, description, type) OV_ERROR_UNLESS(expression, description, type, 0, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_UNLESS_DRU(expression, description, type) OV_ERROR_UNLESS(expression, description, type, CIdentifier::undefined(), m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_UNLESS_DRV(expression, description, type) OV_ERROR_UNLESS(expression, description, type, void() , m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_ERROR_UNLESS_DRN(expression, description, type) OV_ERROR_UNLESS(expression, description, type, nullptr, m_kernelCtx.getErrorManager(), m_kernelCtx.getLogManager()) | |||||
#define OV_FATAL_D(description, type) OV_FATAL(description, type, m_kernelCtx.getLogManager()) | |||||
#define OV_FATAL_UNLESS_D(expression, description, type) OV_FATAL_UNLESS(expression, description, type, m_kernelCtx.getLogManager()) | |||||
#ifndef _MSC_VER | |||||
#define NOEXCEPT noexcept | |||||
#else | |||||
#define NOEXCEPT | |||||
#endif | |||||
class DesignerException final : public std::runtime_error | |||||
{ | |||||
public: | |||||
DesignerException(OpenViBE::Kernel::IErrorManager& errorManager) | |||||
: std::runtime_error("Designer caused an exception"), m_ErrorManager(errorManager) {} | |||||
const char* what() const NOEXCEPT override { return m_ErrorManager.getLastErrorString(); } | |||||
std::string getErrorString() const | |||||
{ | |||||
std::string errorMessage; | |||||
const OpenViBE::Kernel::IError* error = m_ErrorManager.getLastError(); | |||||
while (error) | |||||
{ | |||||
char location[1024]; | |||||
FS::Files::getFilename(error->getErrorLocation(), location); | |||||
errorMessage += "Message: " + std::string(error->getErrorString()) + "\nFile: " + location + "\n"; | |||||
error = error->getNestedError(); | |||||
} | |||||
m_ErrorManager.releaseErrors(); | |||||
return errorMessage; | |||||
} | |||||
void releaseErrors() NOEXCEPT { m_ErrorManager.releaseErrors(); } | |||||
OpenViBE::Kernel::IErrorManager& m_ErrorManager; | |||||
}; | |||||
#define OV_EXCEPTION_D(description, type) \ | |||||
do { \ | |||||
m_kernelCtx.getErrorManager().pushErrorAtLocation(type, static_cast<const OpenViBE::ErrorStream&>(OpenViBE::ErrorStream() << description).str().c_str(), __FILE__, __LINE__ ); \ | |||||
m_kernelCtx.getLogManager() << OpenViBE::Kernel::LogLevel_Fatal << "[Error description] = " << description << "; [Error code] = " << size_t((type)) << "\n"; \ | |||||
throw DesignerException(m_kernelCtx.getErrorManager()); \ | |||||
} while(0) | |||||
#define OV_EXCEPTION_UNLESS_D(expression, description, type) \ | |||||
do { if (!(expression)) { OV_EXCEPTION_D(description, type); } } while(0) |
#include "ovdCAboutPluginDialog.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
bool CAboutPluginDialog::run() | |||||
{ | |||||
if (m_pods == nullptr) { m_pods = m_kernelCtx.getPluginManager().getPluginObjectDescCreating(m_pluginClassID); } | |||||
if (!m_pods) { return false; } | |||||
GtkBuilder* interface = gtk_builder_new(); // glade_xml_new(m_guiFilename.toASCIIString(), "plugin_about", nullptr); | |||||
gtk_builder_add_from_file(interface, m_guiFilename.toASCIIString(), nullptr); | |||||
gtk_builder_connect_signals(interface, nullptr); | |||||
GtkWidget* dialog = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about")); | |||||
GtkWidget* type = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_type")); | |||||
GtkWidget* name = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_name")); | |||||
GtkWidget* authorName = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_author_name")); | |||||
GtkWidget* authorCompanyName = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_company_name")); | |||||
GtkWidget* category = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_category")); | |||||
GtkWidget* version = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_version")); | |||||
GtkWidget* addedSoftwareVersion = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_added_software_version")); | |||||
GtkWidget* updatedSoftwareVersion = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_update_software_version")); | |||||
GtkWidget* shortDesc = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-textview_short_description")); | |||||
GtkWidget* detailedDesc = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-textview_detailed_description")); | |||||
g_object_unref(interface); | |||||
if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_AlgorithmDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Algorithm"); } | |||||
else if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_BoxAlgorithmDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Box algorithm"); } | |||||
else if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_ScenarioImporterDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Scenario importer"); } | |||||
else if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_ScenarioExporterDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Scenario exporter"); } | |||||
GtkTextBuffer* shortDescBuffer = gtk_text_buffer_new(nullptr); | |||||
GtkTextBuffer* detailedDescBuffer = gtk_text_buffer_new(nullptr); | |||||
gtk_text_buffer_set_text(shortDescBuffer, m_pods->getShortDescription(), -1); | |||||
gtk_text_buffer_set_text(detailedDescBuffer, m_pods->getDetailedDescription(), -1); | |||||
gtk_entry_set_text(GTK_ENTRY(name), m_pods->getName()); | |||||
gtk_entry_set_text(GTK_ENTRY(authorName), m_pods->getAuthorName()); | |||||
gtk_entry_set_text(GTK_ENTRY(authorCompanyName), m_pods->getAuthorCompanyName()); | |||||
gtk_entry_set_text(GTK_ENTRY(category), m_pods->getCategory()); | |||||
gtk_entry_set_text(GTK_ENTRY(version), m_pods->getVersion()); | |||||
gtk_entry_set_text(GTK_ENTRY(addedSoftwareVersion), m_pods->getAddedSoftwareVersion()); | |||||
gtk_entry_set_text(GTK_ENTRY(updatedSoftwareVersion), m_pods->getUpdatedSoftwareVersion()); | |||||
gtk_text_view_set_buffer(GTK_TEXT_VIEW(shortDesc), shortDescBuffer); | |||||
gtk_text_view_set_buffer(GTK_TEXT_VIEW(detailedDesc), detailedDescBuffer); | |||||
g_object_unref(shortDescBuffer); | |||||
g_object_unref(detailedDescBuffer); | |||||
gtk_dialog_run(GTK_DIALOG(dialog)); | |||||
gtk_widget_destroy(dialog); | |||||
return true; | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CAboutPluginDialog final | |||||
{ | |||||
public: | |||||
CAboutPluginDialog(const Kernel::IKernelContext& ctx, const CIdentifier& pluginClassID, const char* guiFilename) | |||||
: m_kernelCtx(ctx), m_pluginClassID(pluginClassID), m_guiFilename(guiFilename) { } | |||||
CAboutPluginDialog(const Kernel::IKernelContext& ctx, const Plugins::IPluginObjectDesc* pod, const char* guiFilename) | |||||
: m_kernelCtx(ctx), m_pluginClassID(CIdentifier::undefined()), m_guiFilename(guiFilename), m_pods(pod) { } | |||||
~CAboutPluginDialog() = default; | |||||
bool run(); | |||||
protected: | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
CIdentifier m_pluginClassID = CIdentifier::undefined(); | |||||
CString m_guiFilename; | |||||
const Plugins::IPluginObjectDesc* m_pods = nullptr; | |||||
CAboutPluginDialog() = delete; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCAboutScenarioDialog.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
static void buttonMetaboxReset_clicked(GtkWidget* /*widget*/, gpointer data) { gtk_entry_set_text(GTK_ENTRY(data), CIdentifier::random().str().c_str()); } | |||||
bool CAboutScenarioDialog::run() | |||||
{ | |||||
GtkBuilder* interface = gtk_builder_new(); // glade_xml_new(m_guiFilename.toASCIIString(), "scenario_about", nullptr); | |||||
gtk_builder_add_from_file(interface, m_guiFilename.toASCIIString(), nullptr); | |||||
gtk_builder_connect_signals(interface, nullptr); | |||||
GtkWidget* dialog = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about")); | |||||
GtkWidget* name = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_name")); | |||||
GtkWidget* authorName = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_author_name")); | |||||
GtkWidget* authorCompanyName = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_company_name")); | |||||
GtkWidget* category = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_category")); | |||||
GtkWidget* version = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_version")); | |||||
GtkWidget* documentationPage = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_documentation_page")); | |||||
GtkWidget* addedSoftwareVersion = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_added_software_version")); | |||||
GtkWidget* updatedSoftwareVersion = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_update_software_version")); | |||||
GtkWidget* metaboxId = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-entry_metabox_id")); | |||||
GtkWidget* resetMetaboxId = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-button_reset_metabox_id")); | |||||
const gulong signalHandlerId = g_signal_connect(G_OBJECT(resetMetaboxId), "clicked", G_CALLBACK(buttonMetaboxReset_clicked), metaboxId); | |||||
GtkWidget* shortDesc = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-textview_short_description")); | |||||
GtkWidget* detailedDesc = GTK_WIDGET(gtk_builder_get_object(interface, "scenario_about-textview_detailed_description")); | |||||
g_object_unref(interface); | |||||
gtk_entry_set_text(GTK_ENTRY(name), m_scenario.getAttributeValue(OV_AttributeId_Scenario_Name).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(authorName), m_scenario.getAttributeValue(OV_AttributeId_Scenario_Author).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(authorCompanyName), m_scenario.getAttributeValue(OV_AttributeId_Scenario_Company).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(category), m_scenario.getAttributeValue(OV_AttributeId_Scenario_Category).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(version), m_scenario.getAttributeValue(OV_AttributeId_Scenario_Version).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(documentationPage), m_scenario.getAttributeValue(OV_AttributeId_Scenario_DocumentationPage).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(addedSoftwareVersion), m_scenario.getAttributeValue(OV_AttributeId_Scenario_AddedSoftwareVersion).toASCIIString()); | |||||
gtk_entry_set_text(GTK_ENTRY(updatedSoftwareVersion), m_scenario.getAttributeValue(OV_AttributeId_Scenario_UpdatedSoftwareVersion).toASCIIString()); | |||||
if (m_scenario.isMetabox()) { gtk_entry_set_text(GTK_ENTRY(metaboxId), m_scenario.getAttributeValue(OVP_AttributeId_Metabox_ID).toASCIIString()); } | |||||
else | |||||
{ | |||||
gtk_widget_set_sensitive(metaboxId, FALSE); | |||||
gtk_widget_set_sensitive(resetMetaboxId, FALSE); | |||||
} | |||||
GtkTextBuffer* shortDescBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(shortDesc)); | |||||
gtk_text_buffer_set_text(shortDescBuffer, m_scenario.getAttributeValue(OV_AttributeId_Scenario_ShortDescription).toASCIIString(), -1); | |||||
GtkTextBuffer* detailedDescBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(detailedDesc)); | |||||
gtk_text_buffer_set_text(detailedDescBuffer, m_scenario.getAttributeValue(OV_AttributeId_Scenario_DetailedDescription).toASCIIString(), -1); | |||||
gtk_dialog_run(GTK_DIALOG(dialog)); | |||||
g_signal_handler_disconnect(G_OBJECT(resetMetaboxId), signalHandlerId); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_Name, gtk_entry_get_text(GTK_ENTRY(name))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_Author, gtk_entry_get_text(GTK_ENTRY(authorName))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_Company, gtk_entry_get_text(GTK_ENTRY(authorCompanyName))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_Category, gtk_entry_get_text(GTK_ENTRY(category))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_Version, gtk_entry_get_text(GTK_ENTRY(version))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_DocumentationPage, gtk_entry_get_text(GTK_ENTRY(documentationPage))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_AddedSoftwareVersion, gtk_entry_get_text(GTK_ENTRY(addedSoftwareVersion))); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_UpdatedSoftwareVersion, gtk_entry_get_text(GTK_ENTRY(updatedSoftwareVersion))); | |||||
if (m_scenario.isMetabox()) | |||||
{ | |||||
const CString id(gtk_entry_get_text(GTK_ENTRY(metaboxId))); | |||||
CIdentifier tmp; | |||||
if (!tmp.fromString(id)) | |||||
{ | |||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Invalid identifier " << id | |||||
<< " is not in the \"(0x[0-9a-f]{1-8}, 0x[0-9a-f]{1-8})\" format. "; | |||||
m_kernelCtx.getLogManager() << "Reverting to " << m_scenario.getAttributeValue(OVP_AttributeId_Metabox_ID).toASCIIString() << ".\n"; | |||||
} | |||||
else { m_scenario.setAttributeValue(OVP_AttributeId_Metabox_ID, id); } | |||||
} | |||||
GtkTextIter start, end; | |||||
gtk_text_buffer_get_start_iter(shortDescBuffer, &start); | |||||
gtk_text_buffer_get_end_iter(shortDescBuffer, &end); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_ShortDescription, | |||||
gtk_text_buffer_get_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(shortDesc)), &start, &end, FALSE)); | |||||
gtk_text_buffer_get_start_iter(detailedDescBuffer, &start); | |||||
gtk_text_buffer_get_end_iter(detailedDescBuffer, &end); | |||||
m_scenario.setAttributeValue(OV_AttributeId_Scenario_DetailedDescription, | |||||
gtk_text_buffer_get_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(detailedDesc)), &start, &end, FALSE)); | |||||
gtk_widget_destroy(dialog); | |||||
return true; | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CAboutScenarioDialog final | |||||
{ | |||||
public: | |||||
CAboutScenarioDialog(const Kernel::IKernelContext& ctx, Kernel::IScenario& scenario, const char* guiFilename) | |||||
: m_kernelCtx(ctx), m_scenario(scenario), m_guiFilename(guiFilename) { } | |||||
~CAboutScenarioDialog() = default; | |||||
bool run(); | |||||
protected: | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
Kernel::IScenario& m_scenario; | |||||
CString m_guiFilename; | |||||
CAboutScenarioDialog() = delete; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include <visualization-toolkit/ovvizIVisualizationManager.h> | |||||
#include "ovd_base.h" | |||||
#include "archway/ovdCArchwayHandler.h" | |||||
#include "archway/ovdCArchwayHandlerGUI.h" | |||||
#define OVD_ScenarioImportContext_OpenScenario OpenViBE::CIdentifier(0xA180DB91, 0x19235AEE) | |||||
#define OVD_ScenarioExportContext_SaveScenario OpenViBE::CIdentifier(0xC98C47AD, 0xCBD952B2) | |||||
#define OVD_ScenarioExportContext_SaveMetabox OpenViBE::CIdentifier(0x529494F1, 0x6C2527D9) | |||||
#include <vector> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CInterfacedScenario; | |||||
class CLogListenerDesigner; | |||||
class CApplication | |||||
{ | |||||
public: | |||||
explicit CApplication(const Kernel::IKernelContext& ctx); | |||||
~CApplication(); | |||||
void initialize(ECommandLineFlag cmdLineFlags); | |||||
bool openScenario(const char* filename); | |||||
/** \name Drag and drop management */ | |||||
//@{ | |||||
void dragDataGetCB(GtkWidget* widget, GdkDragContext* dragCtx, GtkSelectionData* selectionData, guint info, guint time) const; | |||||
//@} | |||||
/** \name Selection management */ | |||||
//@{ | |||||
void undoCB(); | |||||
void redoCB(); | |||||
void copySelectionCB(); | |||||
void cutSelectionCB(); | |||||
void pasteSelectionCB(); | |||||
void deleteSelectionCB(); | |||||
void preferencesCB() const; | |||||
//@} | |||||
/** \name Scenario management */ | |||||
//@{ | |||||
CString getWorkingDirectory(); | |||||
bool hasRunningScenario(); | |||||
bool hasUnsavedScenario(); | |||||
CInterfacedScenario* getCurrentInterfacedScenario(); | |||||
void saveOpenedScenarios(); | |||||
void testCB() const; | |||||
void newScenarioCB(); | |||||
void openScenarioCB(); | |||||
void saveScenarioCB(CInterfacedScenario* scenario = nullptr); // defaults to current scenario if nullptr | |||||
void saveScenarioAsCB(CInterfacedScenario* scenario = nullptr); // defaults to current scenario if nullptr | |||||
void closeScenarioCB(CInterfacedScenario* scenario); | |||||
void restoreDefaultScenariosCB() const; | |||||
void stopScenarioCB(); | |||||
void pauseScenarioCB(); | |||||
void nextScenarioCB(); | |||||
void playScenarioCB(); | |||||
void forwardScenarioCB(); | |||||
void configureScenarioSettingsCB(CInterfacedScenario* scenario) const; | |||||
void addCommentCB(CInterfacedScenario* scenario) const; | |||||
void changeCurrentScenario(int pageIdx); | |||||
void reorderCurrentScenario(size_t newPageIdx); | |||||
void addRecentScenario(const std::string& scenarioPath); | |||||
static void cannotSaveScenarioBeforeUpdate(); | |||||
//@} | |||||
/** \name Designer visualization management */ | |||||
//@{ | |||||
void deleteDesignerVisualizationCB(); | |||||
void toggleDesignerVisualizationCB(); | |||||
//@} | |||||
/** \name Player management */ | |||||
//@{ | |||||
Kernel::IPlayer* getPlayer(); | |||||
bool createPlayer(); | |||||
void stopInterfacedScenarioAndReleasePlayer(CInterfacedScenario* scenario); | |||||
//@} | |||||
/** \name Application management */ | |||||
//@{ | |||||
bool quitApplicationCB(); | |||||
void aboutOpenViBECB() const; | |||||
void aboutScenarioCB(CInterfacedScenario* scenario) const; | |||||
void aboutLinkClickedCB(const gchar* url) const; | |||||
void browseDocumentationCB() const; | |||||
static void registerLicenseCB(); | |||||
void reportIssueCB() const; | |||||
void windowStateChangedCB(bool isMaximized); | |||||
bool displayChangelogWhenAvailable(); | |||||
//@} | |||||
void logLevelCB() const; | |||||
//void logLevelMessagesCB(); | |||||
void cpuUsageCB(); | |||||
void zoomInCB(); //Call when a zoom in is required | |||||
void zoomOutCB(); //Call when a zoom out is required | |||||
void spinnerZoomChangedCB(const size_t scaleDelta); | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
Kernel::IPluginManager* m_PluginMgr = nullptr; | |||||
Kernel::IScenarioManager* m_ScenarioMgr = nullptr; | |||||
VisualizationToolkit::IVisualizationManager* m_VisualizationMgr = nullptr; | |||||
Kernel::IScenario* m_ClipboardScenario = nullptr; | |||||
ECommandLineFlag m_CmdLineFlags = CommandLineFlag_None; | |||||
GtkBuilder* m_Builder = nullptr; | |||||
GtkWidget* m_MainWindow = nullptr; | |||||
GtkTreeStore* m_BoxAlgorithmTreeModel = nullptr; | |||||
GtkTreeModel* m_BoxAlgorithmTreeModelFilter = nullptr; | |||||
GtkTreeModel* m_BoxAlgorithmTreeModelFilter2 = nullptr; | |||||
GtkTreeModel* m_BoxAlgorithmTreeModelFilter3 = nullptr; | |||||
GtkTreeModel* m_BoxAlgorithmTreeModelFilter4 = nullptr; | |||||
GtkTreeView* m_BoxAlgorithmTreeView = nullptr; | |||||
GtkTreeStore* m_AlgorithmTreeModel = nullptr; | |||||
GtkSpinButton* m_FastForwardFactor = nullptr; | |||||
// UI for adding inputs and outputs to a scenario | |||||
GtkWidget* m_Inputs = nullptr; | |||||
GtkWidget* m_Outputs = nullptr; | |||||
gint m_FilterTimeout = 0; | |||||
const gchar* m_SearchTerm = nullptr; | |||||
uint64_t m_LastTimeRefresh = 0; | |||||
bool m_IsQuitting = false; | |||||
bool m_IsNewVersion = false; | |||||
std::vector<CInterfacedScenario*> m_Scenarios; | |||||
std::vector<const Plugins::IPluginObjectDesc*> m_NewBoxes; | |||||
std::vector<const Plugins::IPluginObjectDesc*> m_UpdatedBoxes; | |||||
#ifdef MENSIA_DISTRIBUTION | |||||
CArchwayHandler* m_ArchwayHandler = nullptr; | |||||
CArchwayHandlerGUI* m_ArchwayHandlerGUI = nullptr; | |||||
#endif | |||||
protected: | |||||
VisualizationToolkit::IVisualizationContext* m_visualizationCtx = nullptr; | |||||
CLogListenerDesigner* m_logListener = nullptr; | |||||
GtkWidget* m_splashScreen = nullptr; | |||||
GtkNotebook* m_scenarioNotebook = nullptr; | |||||
GtkNotebook* m_resourceNotebook = nullptr; | |||||
GtkTreeView* m_algorithmTreeView = nullptr; | |||||
GtkWidget* m_configureSettingsAddSettingButton = nullptr; | |||||
GtkContainer* m_menuOpenRecent = nullptr; | |||||
std::vector<const GtkWidget*> m_recentScenarios; | |||||
bool m_isMaximized = false; | |||||
size_t m_currentScenarioIdx = 0; | |||||
std::vector<std::string> m_documentedBoxes; | |||||
}; | |||||
} //namespace Designer | |||||
} //namespace OpenViBE |
#include "ovdCBoxConfigurationDialog.h" | |||||
#include "ovdCSettingCollectionHelper.h" | |||||
#include <vector> | |||||
#include <string> | |||||
#include <xml/IXMLHandler.h> | |||||
#include <xml/IXMLNode.h> | |||||
#include <fs/Files.h> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
static const char* const ROOT_NAME = "OpenViBE-SettingsOverride"; | |||||
static const char* const SETTING_NAME = "SettingValue"; | |||||
static void onFileOverrideCheckToggled(GtkToggleButton* button, gpointer data) | |||||
{ | |||||
gtk_widget_set_sensitive(static_cast<GtkWidget*>(data), !gtk_toggle_button_get_active(button)); | |||||
} | |||||
static void OnButtonLoadClicked(GtkButton* /*button*/, gpointer data) { static_cast<CBoxConfigurationDialog*>(data)->loadConfig(); } | |||||
static void OnButtonSaveClicked(GtkButton* /*button*/, gpointer data) { static_cast<CBoxConfigurationDialog*>(data)->saveConfig(); } | |||||
static void OnOverrideBrowseClicked(GtkButton* /*button*/, gpointer data) { static_cast<CBoxConfigurationDialog*>(data)->onOverrideBrowse(); } | |||||
static void CollectWidgetCB(GtkWidget* widget, gpointer data) { static_cast<std::vector<GtkWidget*>*>(data)->push_back(widget); } | |||||
CBoxConfigurationDialog::CBoxConfigurationDialog(const Kernel::IKernelContext& ctx, Kernel::IBox& box, const char* guiFilename, | |||||
const char* guiSettingsFilename, const bool isScenarioRunning) | |||||
: m_kernelCtx(ctx), m_box(box), m_guiFilename(guiFilename), m_guiSettingsFilename(guiSettingsFilename), | |||||
m_settingFactory(m_guiSettingsFilename.toASCIIString(), ctx), m_isScenarioRunning(isScenarioRunning) | |||||
{ | |||||
m_box.addObserver(this); | |||||
if (m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting)) | |||||
{ | |||||
GtkBuilder* builder = gtk_builder_new(); // glade_xml_new(m_guiFilename.toASCIIString(), "box_configuration", nullptr); | |||||
gtk_builder_add_from_file(builder, m_guiFilename.toASCIIString(), nullptr); | |||||
gtk_builder_connect_signals(builder, nullptr); | |||||
if (!m_isScenarioRunning) | |||||
{ | |||||
// TODO : This is not a modal dialog. It would be better if it was. | |||||
m_settingDialog = GTK_WIDGET(gtk_builder_get_object(builder, "box_configuration")); | |||||
const std::string title = std::string("Configure ") + m_box.getName().toASCIIString() + " settings"; | |||||
gtk_window_set_title(GTK_WINDOW(m_settingDialog), title.c_str()); | |||||
} | |||||
else | |||||
{ | |||||
// This is actually *not* a dialog | |||||
m_settingDialog = GTK_WIDGET(gtk_builder_get_object(builder, "box_configuration-scrolledwindow")); | |||||
} | |||||
m_settingsTable = GTK_TABLE(gtk_builder_get_object(builder, "box_configuration-table")); | |||||
m_scrolledWindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object(builder, "box_configuration-scrolledwindow")); | |||||
m_viewPort = GTK_VIEWPORT(gtk_builder_get_object(builder, "box_configuration-viewport")); | |||||
gtk_table_resize(m_settingsTable, guint(m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting)), 4); | |||||
generateSettingsTable(); | |||||
const CSettingCollectionHelper helper(m_kernelCtx, m_guiSettingsFilename.toASCIIString()); | |||||
if (!m_isScenarioRunning) | |||||
{ | |||||
GtkContainer* fileOverrideContainer = GTK_CONTAINER(gtk_builder_get_object(builder, "box_configuration-hbox_filename_override")); | |||||
m_fileOverrideCheck = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "box_configuration-checkbutton_filename_override")); | |||||
GtkButton* buttonLoad = GTK_BUTTON(gtk_builder_get_object(builder, "box_configuration-button_load_current_from_file")); | |||||
GtkButton* buttonSave = GTK_BUTTON(gtk_builder_get_object(builder, "box_configuration-button_save_current_to_file")); | |||||
const std::string settingOverrideWidgetName = helper.getSettingWidgetName(OV_TypeId_Filename).toASCIIString(); | |||||
GtkBuilder* builderInterfaceSettingCollection = gtk_builder_new(); | |||||
gtk_builder_add_from_file(builderInterfaceSettingCollection, m_guiSettingsFilename.toASCIIString(), nullptr); | |||||
m_overrideEntryContainer = GTK_WIDGET(gtk_builder_get_object(builderInterfaceSettingCollection, settingOverrideWidgetName.c_str())); | |||||
std::vector<GtkWidget*> widgets; | |||||
gtk_container_foreach(GTK_CONTAINER(m_overrideEntryContainer), CollectWidgetCB, &widgets); | |||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(m_overrideEntryContainer)), m_overrideEntryContainer); | |||||
gtk_container_add(fileOverrideContainer, m_overrideEntryContainer); | |||||
m_overrideEntry = GTK_ENTRY(widgets[0]); | |||||
g_signal_connect(G_OBJECT(m_fileOverrideCheck), "toggled", G_CALLBACK(onFileOverrideCheckToggled), GTK_WIDGET(m_settingsTable)); | |||||
g_signal_connect(G_OBJECT(widgets[1]), "clicked", G_CALLBACK(OnOverrideBrowseClicked), this); | |||||
g_signal_connect(G_OBJECT(buttonLoad), "clicked", G_CALLBACK(OnButtonLoadClicked), this); | |||||
g_signal_connect(G_OBJECT(buttonSave), "clicked", G_CALLBACK(OnButtonSaveClicked), this); | |||||
if (m_box.hasAttribute(OV_AttributeId_Box_SettingOverrideFilename)) | |||||
{ | |||||
GtkExpander* expander = GTK_EXPANDER(gtk_builder_get_object(builder, "box_configuration-expander")); | |||||
gtk_expander_set_expanded(expander, true); | |||||
gtk_entry_set_text(m_overrideEntry, m_box.getAttributeValue(OV_AttributeId_Box_SettingOverrideFilename).toASCIIString()); | |||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_fileOverrideCheck), true); | |||||
gtk_widget_set_sensitive(GTK_WIDGET(m_settingsTable), false); | |||||
} | |||||
else { gtk_entry_set_text(m_overrideEntry, ""); } | |||||
g_object_unref(builder); | |||||
g_object_unref(builderInterfaceSettingCollection); | |||||
} | |||||
} | |||||
} | |||||
CBoxConfigurationDialog::~CBoxConfigurationDialog() | |||||
{ | |||||
m_box.deleteObserver(this); | |||||
if (m_settingDialog) { gtk_widget_destroy(m_settingDialog); } | |||||
} | |||||
bool CBoxConfigurationDialog::run() | |||||
{ | |||||
bool modified = false; | |||||
if (m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting)) | |||||
{ | |||||
//CSettingCollectionHelper helper(m_kernelCtx, m_guiSettingsFilename.toASCIIString()); | |||||
storeState(); | |||||
bool finished = false; | |||||
while (!finished) | |||||
{ | |||||
const gint result = gtk_dialog_run(GTK_DIALOG(m_settingDialog)); | |||||
if (result == GTK_RESPONSE_APPLY) | |||||
{ | |||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_fileOverrideCheck))) | |||||
{ | |||||
const gchar* fileName = gtk_entry_get_text(m_overrideEntry); | |||||
if (m_box.hasAttribute(OV_AttributeId_Box_SettingOverrideFilename)) | |||||
{ | |||||
m_box.setAttributeValue(OV_AttributeId_Box_SettingOverrideFilename, fileName); | |||||
} | |||||
else { m_box.addAttribute(OV_AttributeId_Box_SettingOverrideFilename, fileName); } | |||||
} | |||||
else | |||||
{ | |||||
if (m_box.hasAttribute(OV_AttributeId_Box_SettingOverrideFilename)) { m_box.removeAttribute(OV_AttributeId_Box_SettingOverrideFilename); } | |||||
} | |||||
finished = true; | |||||
modified = true; | |||||
} | |||||
else if (result == GTK_RESPONSE_CANCEL) | |||||
{ | |||||
restoreState(); | |||||
finished = true; | |||||
} | |||||
else if (result == 1) // default | |||||
{ | |||||
// Some settings will add/remove other settings; | |||||
// by evaluating m_box.getSettingCount() each time we ensure not ending somewhere in the oblivion | |||||
for (size_t i = 0; i < m_settingViews.size(); ++i) | |||||
{ | |||||
CString value; | |||||
m_box.getSettingDefaultValue(i, value); | |||||
m_box.setSettingValue(i, value); | |||||
//m_settingViews[i]->setValue(value); | |||||
//helper.setValue(settingType, i < m_settingViews.size()? m_settingViews[i]->getEntryWidget() : nullptr, value); | |||||
} | |||||
gtk_entry_set_text(GTK_ENTRY(m_overrideEntryContainer), ""); | |||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_fileOverrideCheck), false); | |||||
//gtk_widget_set_sensitive(GTK_WIDGET(m_settingsTable), true); | |||||
modified = false; | |||||
} | |||||
else if (result == 2) // revert | |||||
{ | |||||
restoreState(); | |||||
if (m_box.hasAttribute(OV_AttributeId_Box_SettingOverrideFilename)) | |||||
{ | |||||
gtk_entry_set_text( | |||||
GTK_ENTRY(m_overrideEntryContainer), m_box.getAttributeValue(OV_AttributeId_Box_SettingOverrideFilename).toASCIIString()); | |||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_fileOverrideCheck), true); | |||||
} | |||||
else | |||||
{ | |||||
gtk_entry_set_text(GTK_ENTRY(m_overrideEntryContainer), ""); | |||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_fileOverrideCheck), false); | |||||
} | |||||
} | |||||
else if (result == 3) { modified = true; } // load | |||||
else if (result == 4) { } // save | |||||
else { finished = true; } | |||||
} | |||||
} | |||||
return modified; | |||||
} | |||||
void CBoxConfigurationDialog::update(CObservable& /*o*/, void* data) | |||||
{ | |||||
const Kernel::BoxEventMessage* event = static_cast<Kernel::BoxEventMessage*>(data); | |||||
switch (event->m_Type) | |||||
{ | |||||
case Kernel::SettingsAllChange: | |||||
generateSettingsTable(); | |||||
break; | |||||
case Kernel::SettingValueUpdate: | |||||
{ | |||||
CString value; | |||||
m_box.getSettingValue(event->m_FirstIdx, value); | |||||
m_settingViews[event->m_FirstIdx]->setValue(value); | |||||
break; | |||||
} | |||||
case Kernel::SettingDelete: | |||||
removeSetting(event->m_FirstIdx); | |||||
break; | |||||
case Kernel::SettingAdd: | |||||
addSetting(event->m_FirstIdx); | |||||
break; | |||||
case Kernel::SettingChange: | |||||
settingChange(event->m_FirstIdx); | |||||
break; | |||||
case Kernel::SettingsReorder: break; | |||||
default: break; //OV_ERROR_KRF("wtf", Kernel::ErrorType::BadSetting); | |||||
} | |||||
} | |||||
void CBoxConfigurationDialog::generateSettingsTable() | |||||
{ | |||||
std::for_each(m_settingViews.begin(), m_settingViews.end(), [](Setting::CAbstractSettingView* elem) { delete elem; }); | |||||
m_settingViews.clear(); | |||||
//Remove rows | |||||
gtk_container_foreach(GTK_CONTAINER(GTK_WIDGET(m_settingsTable)), | |||||
[](GtkWidget* widget, gpointer data) { gtk_container_remove(GTK_CONTAINER(data), widget); }, | |||||
GTK_WIDGET(m_settingsTable)); | |||||
size_t size = 0; | |||||
if (m_isScenarioRunning) | |||||
{ | |||||
for (size_t i = 0; i < m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting); ++i) | |||||
{ | |||||
bool mod = false; | |||||
m_box.getSettingMod(i, mod); | |||||
if (mod) { size++; } | |||||
} | |||||
} | |||||
else { size = m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting); } | |||||
gtk_table_resize(m_settingsTable, guint(size + 2), 4); | |||||
// Iterate over box settings, generate corresponding gtk widgets. If the scenario is running, we are making a | |||||
// 'modifiable settings' dialog and use a subset of widgets with a slightly different layout and buttons. | |||||
for (size_t settingIdx = 0, tableIdx = 0; settingIdx < m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting); ++settingIdx) | |||||
{ | |||||
if (addSettingsToView(settingIdx, tableIdx)) { ++tableIdx; } | |||||
} | |||||
updateSize(); | |||||
} | |||||
bool CBoxConfigurationDialog::addSettingsToView(const size_t settingIdx, const size_t tableIdx) | |||||
{ | |||||
bool modifiable; | |||||
m_box.getSettingMod(settingIdx, modifiable); | |||||
if ((!m_isScenarioRunning) || (m_isScenarioRunning && modifiable)) | |||||
{ | |||||
CString name; | |||||
m_box.getSettingName(settingIdx, name); | |||||
Setting::CAbstractSettingView* view = m_settingFactory.getSettingView(m_box, settingIdx); | |||||
bool isDeprecated = false; | |||||
m_box.getInterfacorDeprecatedStatus(Kernel::EBoxInterfacorType::Setting, settingIdx, isDeprecated); | |||||
if (isDeprecated) | |||||
{ | |||||
gtk_widget_set_sensitive(GTK_WIDGET(view->getNameWidget()), false); | |||||
gtk_widget_set_sensitive(GTK_WIDGET(view->getEntryWidget()), false); | |||||
} | |||||
gtk_table_attach(m_settingsTable, view->getNameWidget(), 0, 1, guint(tableIdx), guint(tableIdx + 1), GtkAttachOptions(GTK_FILL), | |||||
GtkAttachOptions(GTK_FILL), 0, 0); | |||||
gtk_table_attach(m_settingsTable, view->getEntryWidget(), 1, 4, guint(tableIdx), guint(tableIdx + 1), | |||||
GtkAttachOptions(GTK_SHRINK | GTK_FILL | GTK_EXPAND), GtkAttachOptions(GTK_SHRINK), 0, 0); | |||||
m_settingViews.insert(m_settingViews.begin() + tableIdx, view); | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
void CBoxConfigurationDialog::settingChange(const size_t index) | |||||
{ | |||||
//We remeber the place to add the new setting at the same place | |||||
const size_t indexTable = getTableIndex(index); | |||||
removeSetting(index, false); | |||||
addSettingsToView(index, indexTable); | |||||
} | |||||
void CBoxConfigurationDialog::addSetting(const size_t index) | |||||
{ | |||||
bool modifiable; | |||||
m_box.getSettingMod(index, modifiable); | |||||
if ((!m_isScenarioRunning) || (m_isScenarioRunning && modifiable)) | |||||
{ | |||||
const size_t size = m_settingViews.size(); | |||||
/*There is two case. | |||||
1) we just add at the end of the setting box | |||||
2) we add it in the middle end we need to shift | |||||
*/ | |||||
const size_t tableIdx = (index > m_settingViews[size - 1]->getSettingIndex()) ? size : getTableIndex(index); | |||||
gtk_table_resize(m_settingsTable, guint(size + 2), 4); | |||||
if (index <= m_settingViews[size - 1]->getSettingIndex()) | |||||
{ | |||||
for (size_t i = size - 1; i >= tableIdx; --i) | |||||
{ | |||||
Setting::CAbstractSettingView* view = m_settingViews[i]; | |||||
//We need to update the index | |||||
view->setSettingIndex(view->getSettingIndex() + 1); | |||||
gtk_container_remove(GTK_CONTAINER(m_settingsTable), view->getNameWidget()); | |||||
gtk_table_attach(m_settingsTable, view->getNameWidget(), 0, 1, guint(i + 1), guint(i + 2), GtkAttachOptions(GTK_FILL), | |||||
GtkAttachOptions(GTK_FILL), 0, 0); | |||||
gtk_container_remove(GTK_CONTAINER(m_settingsTable), view->getEntryWidget()); | |||||
gtk_table_attach(m_settingsTable, view->getEntryWidget(), 1, 4, guint(i + 1), guint(i + 2), | |||||
GtkAttachOptions(GTK_SHRINK | GTK_FILL | GTK_EXPAND), GtkAttachOptions(GTK_SHRINK), 0, 0); | |||||
} | |||||
} | |||||
addSettingsToView(size_t(tableIdx), index); | |||||
updateSize(); | |||||
} | |||||
//Even if nothing is add to the interface, we still need to update index | |||||
else | |||||
{ | |||||
for (Setting::CAbstractSettingView* view : m_settingViews) | |||||
{ | |||||
if (view->getSettingIndex() >= index) { view->setSettingIndex(view->getSettingIndex() + 1); } | |||||
} | |||||
} | |||||
} | |||||
void CBoxConfigurationDialog::removeSetting(const size_t index, const bool shift) | |||||
{ | |||||
const int tableIdx = getTableIndex(index); | |||||
if (tableIdx != -1) | |||||
{ | |||||
Setting::CAbstractSettingView* view = m_settingViews[tableIdx]; | |||||
GtkWidget* name = view->getNameWidget(); | |||||
GtkWidget* entry = view->getEntryWidget(); | |||||
gtk_container_remove(GTK_CONTAINER(m_settingsTable), name); | |||||
gtk_container_remove(GTK_CONTAINER(m_settingsTable), entry); | |||||
delete view; | |||||
m_settingViews.erase(m_settingViews.begin() + tableIdx); | |||||
//Now if we need to do it we shift everything to avoid an empty row in the table | |||||
if (shift) | |||||
{ | |||||
for (size_t i = tableIdx; i < m_settingViews.size(); ++i) | |||||
{ | |||||
view = m_settingViews[i]; | |||||
view->setSettingIndex(view->getSettingIndex() - 1); | |||||
gtk_container_remove(GTK_CONTAINER(m_settingsTable), view->getNameWidget()); | |||||
gtk_table_attach(m_settingsTable, view->getNameWidget(), 0, 1, guint(i), guint(i + 1), GtkAttachOptions(GTK_FILL), GtkAttachOptions(GTK_FILL), | |||||
0, 0); | |||||
gtk_container_remove(GTK_CONTAINER(m_settingsTable), view->getEntryWidget()); | |||||
gtk_table_attach(m_settingsTable, view->getEntryWidget(), 1, 4, guint(i), guint(i + 1), GtkAttachOptions(GTK_SHRINK | GTK_FILL | GTK_EXPAND), | |||||
GtkAttachOptions(GTK_SHRINK), 0, 0); | |||||
} | |||||
//Now let's resize everything | |||||
gtk_table_resize(m_settingsTable, guint(m_settingViews.size() + 2), 4); | |||||
updateSize(); | |||||
} | |||||
} | |||||
//Even if we delete an "invisible" setting we need to update every index. | |||||
else | |||||
{ | |||||
for (Setting::CAbstractSettingView* view : m_settingViews) | |||||
{ | |||||
if (view->getSettingIndex() >= index) { view->setSettingIndex(view->getSettingIndex() - 1); } | |||||
} | |||||
} | |||||
} | |||||
int CBoxConfigurationDialog::getTableIndex(const size_t index) | |||||
{ | |||||
size_t tableIdx = 0; | |||||
for (auto it = m_settingViews.begin(); it != m_settingViews.end(); ++it, ++tableIdx) | |||||
{ | |||||
Setting::CAbstractSettingView* view = *it; | |||||
if (view->getSettingIndex() == index) { return int(index); } | |||||
} | |||||
return -1; | |||||
} | |||||
void CBoxConfigurationDialog::updateSize() const | |||||
{ | |||||
// Resize the window to fit as much of the table as possible, but keep the max size | |||||
// limited so it doesn't get outside the screen. For safety, we cap to 800x600 | |||||
// anyway to hopefully prevent the window from going under things such as the gnome toolbar. | |||||
// The ui file at the moment does not allow resize of this window because the result | |||||
// looked ugly if the window was made overly large, and no satisfying solution at the time was | |||||
// found by the limited intellectual resources available. | |||||
const gint maxWidth = std::min(800, gdk_screen_get_width(gdk_screen_get_default())); | |||||
const gint maxHeight = std::min(600, gdk_screen_get_height(gdk_screen_get_default())); | |||||
GtkRequisition size; | |||||
gtk_widget_size_request(GTK_WIDGET(m_viewPort), &size); | |||||
gtk_widget_set_size_request(GTK_WIDGET(m_scrolledWindow), gint(std::min(maxWidth, size.width)), gint(std::min(maxHeight, size.height))); | |||||
} | |||||
void CBoxConfigurationDialog::saveConfig() const | |||||
{ | |||||
GtkWidget* widgetDialogOpen = gtk_file_chooser_dialog_new("Select file to save settings to...", nullptr, GTK_FILE_CHOOSER_ACTION_SAVE, | |||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, nullptr); | |||||
const gchar* initialFileNameToExpand = gtk_entry_get_text(GTK_ENTRY(m_overrideEntryContainer)); | |||||
const CString initialFileName = m_kernelCtx.getConfigurationManager().expand(initialFileNameToExpand); | |||||
if (g_path_is_absolute(initialFileName.toASCIIString())) | |||||
{ | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), initialFileName.toASCIIString()); | |||||
} | |||||
else | |||||
{ | |||||
char* fullPath = g_build_filename(g_get_current_dir(), initialFileName.toASCIIString(), nullptr); | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), fullPath); | |||||
g_free(fullPath); | |||||
} | |||||
if (gtk_dialog_run(GTK_DIALOG(widgetDialogOpen)) == GTK_RESPONSE_ACCEPT) | |||||
{ | |||||
char* fileName = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widgetDialogOpen)); | |||||
XML::IXMLHandler* handler = XML::createXMLHandler(); | |||||
XML::IXMLNode* rootNode = XML::createNode(ROOT_NAME); | |||||
for (size_t i = 0; i < m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting); ++i) | |||||
{ | |||||
XML::IXMLNode* tmpNode = XML::createNode(SETTING_NAME); | |||||
CString value; | |||||
m_box.getSettingValue(size_t(i), value); | |||||
tmpNode->setPCData(value.toASCIIString()); | |||||
rootNode->addChild(tmpNode); | |||||
} | |||||
handler->writeXMLInFile(*rootNode, fileName); | |||||
handler->release(); | |||||
rootNode->release(); | |||||
g_free(fileName); | |||||
} | |||||
gtk_widget_destroy(widgetDialogOpen); | |||||
} | |||||
void CBoxConfigurationDialog::loadConfig() const | |||||
{ | |||||
GtkWidget* widgetDialogOpen = gtk_file_chooser_dialog_new("Select file to load settings from...", nullptr, GTK_FILE_CHOOSER_ACTION_SAVE, | |||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, nullptr); | |||||
const gchar* filenameToExpand = gtk_entry_get_text(GTK_ENTRY(m_overrideEntryContainer)); | |||||
const CString filename = m_kernelCtx.getConfigurationManager().expand(filenameToExpand); | |||||
if (g_path_is_absolute(filename.toASCIIString())) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), filename.toASCIIString()); } | |||||
else | |||||
{ | |||||
char* fullPath = g_build_filename(g_get_current_dir(), filename.toASCIIString(), nullptr); | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), fullPath); | |||||
g_free(fullPath); | |||||
} | |||||
if (gtk_dialog_run(GTK_DIALOG(widgetDialogOpen)) == GTK_RESPONSE_ACCEPT) | |||||
{ | |||||
char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widgetDialogOpen)); | |||||
XML::IXMLHandler* handler = XML::createXMLHandler(); | |||||
XML::IXMLNode* rootNode = handler->parseFile(path); | |||||
for (size_t i = 0; i < rootNode->getChildCount(); ++i) | |||||
{ | |||||
//Hope everything will fit in the right place | |||||
m_box.setSettingValue(size_t(i), rootNode->getChild(i)->getPCData()); | |||||
} | |||||
rootNode->release(); | |||||
handler->release(); | |||||
g_free(path); | |||||
} | |||||
gtk_widget_destroy(widgetDialogOpen); | |||||
} | |||||
void CBoxConfigurationDialog::onOverrideBrowse() const | |||||
{ | |||||
GtkWidget* widgetDialogOpen = gtk_file_chooser_dialog_new("Select file to open...", nullptr, GTK_FILE_CHOOSER_ACTION_SAVE, | |||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, nullptr); | |||||
const CString initialFilename = m_kernelCtx.getConfigurationManager().expand(gtk_entry_get_text(GTK_ENTRY(m_overrideEntry))); | |||||
if (g_path_is_absolute(initialFilename.toASCIIString())) | |||||
{ | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), initialFilename.toASCIIString()); | |||||
} | |||||
else | |||||
{ | |||||
char* fullPath = g_build_filename(g_get_current_dir(), initialFilename.toASCIIString(), nullptr); | |||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widgetDialogOpen), fullPath); | |||||
g_free(fullPath); | |||||
} | |||||
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(widgetDialogOpen), false); | |||||
if (gtk_dialog_run(GTK_DIALOG(widgetDialogOpen)) == GTK_RESPONSE_ACCEPT) | |||||
{ | |||||
gchar* name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widgetDialogOpen)); | |||||
std::string filename(name); | |||||
g_free(name); | |||||
std::replace(filename.begin(), filename.end(), '\\', '/'); | |||||
gtk_entry_set_text(GTK_ENTRY(m_overrideEntry), filename.c_str()); | |||||
} | |||||
gtk_widget_destroy(widgetDialogOpen); | |||||
} | |||||
void CBoxConfigurationDialog::storeState() | |||||
{ | |||||
m_settingsMemory.clear(); | |||||
for (size_t i = 0; i < m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting); ++i) | |||||
{ | |||||
CString temp; | |||||
m_box.getSettingValue(i, temp); | |||||
m_settingsMemory.push_back(temp); | |||||
} | |||||
} | |||||
void CBoxConfigurationDialog::restoreState() | |||||
{ | |||||
for (size_t i = 0; i < m_settingsMemory.size(); ++i) | |||||
{ | |||||
if (i >= m_box.getInterfacorCountIncludingDeprecated(Kernel::EBoxInterfacorType::Setting)) { return; } // This is not supposed to happen | |||||
m_box.setSettingValue(i, m_settingsMemory[i]); | |||||
} | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
#include <string> | |||||
#include "dynamic_settings/ovdCAbstractSettingView.h" | |||||
#include "dynamic_settings/ovdCSettingViewFactory.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CBoxConfigurationDialog final : public IObserver | |||||
{ | |||||
public: | |||||
CBoxConfigurationDialog(const Kernel::IKernelContext& ctx, Kernel::IBox& box, const char* guiFilename, | |||||
const char* guiSettingsFilename, const bool isScenarioRunning = false); | |||||
~CBoxConfigurationDialog() override; | |||||
bool run(); | |||||
void update(CObservable& o, void* data) override; | |||||
void saveConfig() const; | |||||
void loadConfig() const; | |||||
void onOverrideBrowse() const; | |||||
void storeState(); | |||||
void restoreState(); | |||||
CIdentifier getBoxID() const { return m_box.getIdentifier(); } | |||||
GtkWidget* getWidget() const { return m_settingDialog; } | |||||
protected: | |||||
void generateSettingsTable(); | |||||
bool addSettingsToView(const size_t settingIdx, const size_t tableIdx); | |||||
void updateSize() const; | |||||
void settingChange(const size_t index); | |||||
void addSetting(const size_t index); | |||||
void removeSetting(const size_t index, bool shift = true); | |||||
int getTableIndex(const size_t index); | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
Kernel::IBox& m_box; | |||||
CString m_guiFilename; | |||||
CString m_guiSettingsFilename; | |||||
Setting::CSettingViewFactory m_settingFactory; | |||||
std::vector<Setting::CAbstractSettingView*> m_settingViews; | |||||
GtkTable* m_settingsTable = nullptr; | |||||
GtkViewport* m_viewPort = nullptr; | |||||
GtkScrolledWindow* m_scrolledWindow = nullptr; | |||||
GtkEntry* m_overrideEntry = nullptr; | |||||
GtkWidget* m_overrideEntryContainer = nullptr; | |||||
GtkWidget* m_settingDialog = nullptr; | |||||
GtkCheckButton* m_fileOverrideCheck = nullptr; | |||||
bool m_isScenarioRunning = false; | |||||
std::vector<CString> m_settingsMemory; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCBoxProxy.h" | |||||
#include "ovdTAttributeHandler.h" | |||||
#include <fs/Files.h> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
CBoxProxy::CBoxProxy(const Kernel::IKernelContext& ctx, Kernel::IScenario& scenario, const CIdentifier& boxID) | |||||
: m_kernelCtx(ctx), m_constBox(scenario.getBoxDetails(boxID)), m_box(scenario.getBoxDetails(boxID)), | |||||
m_isDeprecated(m_kernelCtx.getPluginManager().isPluginObjectFlaggedAsDeprecated(m_constBox->getAlgorithmClassIdentifier())) | |||||
{ | |||||
m_isBoxAlgorithmPresent = false; | |||||
if (m_constBox) | |||||
{ | |||||
if (m_constBox->getAlgorithmClassIdentifier() == OVP_ClassId_BoxAlgorithm_Metabox) | |||||
{ | |||||
CIdentifier metaboxId; | |||||
metaboxId.fromString(m_constBox->getAttributeValue(OVP_AttributeId_Metabox_ID)); | |||||
const CString path(m_kernelCtx.getMetaboxManager().getMetaboxFilePath(metaboxId)); | |||||
m_isBoxAlgorithmPresent = FS::Files::fileExists(path.toASCIIString()); | |||||
} | |||||
else { m_isBoxAlgorithmPresent = m_kernelCtx.getPluginManager().canCreatePluginObject(m_constBox->getAlgorithmClassIdentifier()); } | |||||
const TAttributeHandler handler(*m_constBox); | |||||
m_centerX = handler.getAttributeValue<int>(OV_AttributeId_Box_XCenterPosition); | |||||
m_centerY = handler.getAttributeValue<int>(OV_AttributeId_Box_YCenterPosition); | |||||
} | |||||
m_showOriginalNameWhenModified = m_kernelCtx.getConfigurationManager().expandAsBoolean("${Designer_ShowOriginalBoxName}", true); | |||||
} | |||||
int CBoxProxy::getWidth(GtkWidget* widget) const | |||||
{ | |||||
int x, y; | |||||
updateSize(widget, getLabel(), getStatusLabel(), &x, &y); | |||||
return x; | |||||
} | |||||
int CBoxProxy::getHeight(GtkWidget* widget) const | |||||
{ | |||||
int x, y; | |||||
updateSize(widget, getLabel(), getStatusLabel(), &x, &y); | |||||
return y; | |||||
} | |||||
void CBoxProxy::setCenter(const int x, const int y) | |||||
{ | |||||
m_centerX = x; | |||||
m_centerY = y; | |||||
m_applied = false; | |||||
} | |||||
void CBoxProxy::setBoxAlgorithmDescriptorOverride(const Plugins::IBoxAlgorithmDesc* pBoxAlgorithmDescriptor) | |||||
{ | |||||
m_boxAlgorithmDescOverride = pBoxAlgorithmDescriptor; | |||||
} | |||||
void CBoxProxy::apply() | |||||
{ | |||||
if (m_box) | |||||
{ | |||||
TAttributeHandler handler(*m_box); | |||||
if (handler.hasAttribute(OV_AttributeId_Box_XCenterPosition)) { handler.setAttributeValue<int>(OV_AttributeId_Box_XCenterPosition, m_centerX); } | |||||
else { handler.addAttribute<int>(OV_AttributeId_Box_XCenterPosition, m_centerX); } | |||||
if (handler.hasAttribute(OV_AttributeId_Box_YCenterPosition)) { handler.setAttributeValue<int>(OV_AttributeId_Box_YCenterPosition, m_centerY); } | |||||
else { handler.addAttribute<int>(OV_AttributeId_Box_YCenterPosition, m_centerY); } | |||||
m_applied = true; | |||||
} | |||||
} | |||||
const char* CBoxProxy::getLabel() const | |||||
{ | |||||
const bool canChangeInput( | |||||
m_constBox->hasAttribute(OV_AttributeId_Box_FlagCanModifyInput) || m_constBox->hasAttribute(OV_AttributeId_Box_FlagCanAddInput)); | |||||
const bool canChangeOutput( | |||||
m_constBox->hasAttribute(OV_AttributeId_Box_FlagCanModifyOutput) || m_constBox->hasAttribute(OV_AttributeId_Box_FlagCanAddOutput)); | |||||
const bool canChangeSetting( | |||||
m_constBox->hasAttribute(OV_AttributeId_Box_FlagCanModifySetting) || m_constBox->hasAttribute(OV_AttributeId_Box_FlagCanAddSetting)); | |||||
const Plugins::IPluginObjectDesc* desc = (m_boxAlgorithmDescOverride == nullptr | |||||
? m_kernelCtx.getPluginManager().getPluginObjectDescCreating(m_constBox->getAlgorithmClassIdentifier()) | |||||
: m_boxAlgorithmDescOverride); | |||||
std::string name(m_constBox->getName()); | |||||
const std::string red("#602020"), green("#206020"), grey("#404040"); | |||||
// pango is used in the box diplay to format the box name (e.g. bold to tell it's a configurable box) | |||||
// incidently, this makes the box name pango-enabled. If an error appears in the markup, the box display would be wrong. | |||||
if (!pango_parse_markup(name.c_str(), -1, 0, nullptr, nullptr, nullptr, nullptr)) | |||||
{ | |||||
// the name uses invalid markup characters | |||||
// we sanitize the markup tag overture '<' | |||||
// markup should not be used in the box name anyway (hidden feature), | |||||
// but the character '<' may actually be useful in a valid name | |||||
for (size_t c = 0; c < name.size(); ++c) | |||||
{ | |||||
if (name[c] == '<') | |||||
{ | |||||
name[c] = ';'; | |||||
name.insert(c, "<"); | |||||
} | |||||
else if (name[c] == '&') | |||||
{ | |||||
name[c] = ';'; | |||||
name.insert(c, "&"); | |||||
} | |||||
} | |||||
} | |||||
m_label = name; | |||||
if (name.empty()) { m_label = "Unnamed Box"; } | |||||
const std::string boxNameColor = "#000000"; | |||||
if (m_constBox->getSettingCount() != 0) { m_label = "<span color=\"" + boxNameColor + R"(" weight="bold">)" + m_label + "</span>"; } | |||||
if (m_showOriginalNameWhenModified) | |||||
{ | |||||
const std::string boxOriginalName(desc ? std::string(desc->getName()) : name); | |||||
if (boxOriginalName != name) { m_label = "<small><i><span foreground=\"" + grey + "\">" + boxOriginalName + "</span></i></small>\n" + m_label; } | |||||
} | |||||
if (canChangeInput || canChangeOutput || canChangeSetting) | |||||
{ | |||||
m_label += "\n<span size=\"smaller\">"; | |||||
m_label += "<span foreground=\"" + (canChangeInput ? green : red) + "\">In</span>"; | |||||
m_label += "|<span foreground=\"" + (canChangeOutput ? green : red) + "\">Out</span>"; | |||||
m_label += "|<span foreground=\"" + (canChangeSetting ? green : red) + "\">Set</span>"; | |||||
m_label += "</span>"; | |||||
} | |||||
return m_label.c_str(); | |||||
} | |||||
const char* CBoxProxy::getStatusLabel() const | |||||
{ | |||||
const bool toBeUpdated(m_box->hasAttribute(OV_AttributeId_Box_ToBeUpdated)); | |||||
const bool pendingDeprecatedInterfacors(m_box->hasAttribute(OV_AttributeId_Box_PendingDeprecatedInterfacors)); | |||||
const bool isDeprecated(this->isBoxAlgorithmPluginPresent() && this->isDeprecated()); | |||||
const bool isDisabled(this->isDisabled()); | |||||
const std::string blue("#202060"); | |||||
m_status = ""; | |||||
if (isDeprecated || toBeUpdated || isDisabled || pendingDeprecatedInterfacors) | |||||
{ | |||||
m_status += R"(<span size="smaller" foreground=")" + blue + "\">"; | |||||
if (isDeprecated) { m_status += " <span style=\"italic\">deprecated</span>"; } | |||||
if (toBeUpdated) { m_status += " <span style=\"italic\">update</span>"; } | |||||
if (isDisabled) { m_status += " <span style=\"italic\">disabled</span>"; } | |||||
if (pendingDeprecatedInterfacors) { m_status += " <span style=\"italic\">deprecated I/O/S</span>"; } | |||||
m_status += " </span>"; | |||||
} | |||||
return m_status.c_str(); | |||||
} | |||||
bool CBoxProxy::isDisabled() const | |||||
{ | |||||
const TAttributeHandler handler(*m_constBox); | |||||
return handler.hasAttribute(OV_AttributeId_Box_Disabled); | |||||
} | |||||
void CBoxProxy::updateSize(GtkWidget* widget, const char* label, const char* status, int* xSize, int* ySize) const | |||||
{ | |||||
PangoRectangle labelRect; | |||||
PangoRectangle statusRect; | |||||
PangoContext* context = gtk_widget_create_pango_context(widget); | |||||
PangoLayout* layout = pango_layout_new(context); | |||||
pango_layout_set_markup(layout, label, -1); | |||||
pango_layout_get_pixel_extents(layout, nullptr, &labelRect); | |||||
pango_layout_set_markup(layout, status, -1); | |||||
pango_layout_get_pixel_extents(layout, nullptr, &statusRect); | |||||
if (!strlen(status)) | |||||
{ | |||||
statusRect.width = 0; | |||||
statusRect.height = 0; | |||||
} | |||||
*xSize = std::max(labelRect.width, statusRect.width); | |||||
*ySize = labelRect.height + statusRect.height; | |||||
g_object_unref(layout); | |||||
g_object_unref(context); | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
#include <string> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CBoxProxy final | |||||
{ | |||||
public: | |||||
CBoxProxy(const Kernel::IKernelContext& ctx, Kernel::IScenario& scenario, const CIdentifier& boxID); | |||||
~CBoxProxy() { if (!m_applied) { this->apply(); } } | |||||
operator Kernel::IBox*() const { return m_box; } | |||||
operator const Kernel::IBox*() const { return m_constBox; } | |||||
int getWidth(GtkWidget* widget) const; | |||||
int getHeight(GtkWidget* widget) const; | |||||
int getXCenter() const { return m_centerX; } | |||||
int getYCenter() const { return m_centerY; } | |||||
void setCenter(int x, int y); | |||||
void setBoxAlgorithmDescriptorOverride(const Plugins::IBoxAlgorithmDesc* pBoxAlgorithmDescriptor); | |||||
void apply(); | |||||
const char* getLabel() const; | |||||
const char* getStatusLabel() const; | |||||
bool isBoxAlgorithmPluginPresent() const { return m_isBoxAlgorithmPresent; } | |||||
bool isUpToDate() const { return !m_box->hasAttribute(OV_AttributeId_Box_ToBeUpdated); } | |||||
bool hasPendingDeprecatedInterfacors() const { return m_box->hasAttribute(OV_AttributeId_Box_PendingDeprecatedInterfacors); } | |||||
bool isDeprecated() const { return m_isDeprecated; } | |||||
static bool isUnstable() { return false; } | |||||
bool isDisabled() const; | |||||
bool isMetabox() const { return m_constBox->getAlgorithmClassIdentifier() == OVP_ClassId_BoxAlgorithm_Metabox; } | |||||
protected: | |||||
void updateSize(GtkWidget* widget, const char* label, const char* status, int* xSize, int* ySize) const; | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
const Plugins::IBoxAlgorithmDesc* m_boxAlgorithmDescOverride = nullptr; | |||||
const Kernel::IBox* m_constBox = nullptr; | |||||
Kernel::IBox* m_box = nullptr; | |||||
bool m_applied = false; | |||||
bool m_showOriginalNameWhenModified = false; | |||||
int m_centerX = 0; | |||||
int m_centerY = 0; | |||||
mutable std::string m_label; | |||||
mutable std::string m_status; | |||||
bool m_isBoxAlgorithmPresent = false; | |||||
bool m_isDeprecated = false; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCCommentEditorDialog.h" | |||||
#include <cstring> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
static void BoldSelectionCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<b>", "</b>"); } | |||||
static void ItalicSelectionCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<i>", "</i>"); } | |||||
static void UnderlineCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<u>", "</u>"); } | |||||
static void StrikethroughCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<s>", "</s>"); } | |||||
static void MonoCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<tt>", "</tt>"); } | |||||
static void SubscriptCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<sub>", "</sub>"); } | |||||
static void SuperscriptCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<sup>", "</sup>"); } | |||||
static void BigCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<big>", "</big>"); } | |||||
static void SmallCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<small>", "</small>"); } | |||||
static void RedCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<span color=\"red\">", "</span>"); } | |||||
static void GreenCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<span color=\"green\">", "</span>"); } | |||||
static void BlueCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->applyTagCB("<span color=\"blue\">", "</span>"); } | |||||
static void InfoCB(GtkButton* /*button*/, gpointer data) { static_cast<CCommentEditorDialog*>(data)->infoCB(); } | |||||
bool CCommentEditorDialog::run() | |||||
{ | |||||
bool res = false; | |||||
m_interface = gtk_builder_new(); // glade_xml_new(m_guiFilename.toASCIIString(), "comment", nullptr); | |||||
gtk_builder_add_from_file(m_interface, m_guiFilename.toASCIIString(), nullptr); | |||||
gtk_builder_connect_signals(m_interface, nullptr); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_bold"), "clicked", G_CALLBACK(BoldSelectionCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_italic"), "clicked", G_CALLBACK(ItalicSelectionCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_underline"), "clicked", G_CALLBACK(UnderlineCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_strikethrough"), "clicked", G_CALLBACK(StrikethroughCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_mono"), "clicked", G_CALLBACK(MonoCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_subscript"), "clicked", G_CALLBACK(SubscriptCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_superscript"), "clicked", G_CALLBACK(SuperscriptCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_big"), "clicked", G_CALLBACK(BigCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_small"), "clicked", G_CALLBACK(SmallCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_red"), "clicked", G_CALLBACK(RedCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_green"), "clicked", G_CALLBACK(GreenCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_blue"), "clicked", G_CALLBACK(BlueCB), this); | |||||
::g_signal_connect(gtk_builder_get_object(m_interface, "comment_toolbutton_info"), "clicked", G_CALLBACK(InfoCB), this); | |||||
m_dialog = GTK_WIDGET(gtk_builder_get_object(m_interface, "comment")); | |||||
m_desc = GTK_WIDGET(gtk_builder_get_object(m_interface, "comment-textview_description")); | |||||
m_infoDialog = GTK_WIDGET(gtk_builder_get_object(m_interface, "messagedialog_howto_comment")); | |||||
::g_signal_connect(m_infoDialog, "close", G_CALLBACK(gtk_widget_hide), nullptr); | |||||
::g_signal_connect(m_infoDialog, "delete-event", G_CALLBACK(gtk_widget_hide), nullptr); | |||||
//::g_signal_connect(GTK_WIDGET(gtk_builder_get_object(m_interface, "messagedialog_howto_comment_button_close")), "clicked", G_CALLBACK(gtk_widget_hide), nullptr); | |||||
g_object_unref(m_interface); | |||||
m_buffer = gtk_text_buffer_new(nullptr); | |||||
gtk_text_buffer_set_text(m_buffer, m_comment.getText().toASCIIString(), -1); | |||||
gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_desc), m_buffer); | |||||
g_object_unref(m_buffer); | |||||
gtk_widget_grab_focus(m_desc); | |||||
const gint result = gtk_dialog_run(GTK_DIALOG(m_dialog)); | |||||
if (result == GTK_RESPONSE_APPLY) | |||||
{ | |||||
res = true; | |||||
GtkTextIter start, end; | |||||
m_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_desc)); | |||||
gtk_text_buffer_get_start_iter(m_buffer, &start); | |||||
gtk_text_buffer_get_end_iter(m_buffer, &end); | |||||
m_comment.setText(gtk_text_buffer_get_text(m_buffer, &start, &end, TRUE)); | |||||
} | |||||
gtk_widget_destroy(m_infoDialog); | |||||
gtk_widget_destroy(m_dialog); | |||||
return res; | |||||
} | |||||
//----------------------------------------------------------------------------------- | |||||
void CCommentEditorDialog::applyTagCB(const char* in, const char* out) const | |||||
{ | |||||
GtkTextIter start, end; | |||||
if (gtk_text_buffer_get_has_selection(m_buffer)) | |||||
{ | |||||
gtk_text_buffer_get_selection_bounds(m_buffer, &start, &end); | |||||
gtk_text_buffer_insert(m_buffer, &start, in, gint(strlen(in))); | |||||
gtk_text_buffer_get_selection_bounds(m_buffer, &start, &end); | |||||
gtk_text_buffer_insert(m_buffer, &end, out, gint(strlen(out))); | |||||
// reset selection to the selected text, as the tagOut is now selected | |||||
gtk_text_buffer_get_selection_bounds(m_buffer, &start, &end); | |||||
gtk_text_iter_backward_chars(&end, gint(strlen(out))); | |||||
gtk_text_buffer_select_range(m_buffer, &start, &end); | |||||
} | |||||
else | |||||
{ | |||||
gtk_text_buffer_get_selection_bounds(m_buffer, &start, &end); | |||||
const gint offset = gtk_text_iter_get_offset(&start); | |||||
gtk_text_buffer_insert_at_cursor(m_buffer, in, gint(strlen(in))); | |||||
gtk_text_buffer_insert_at_cursor(m_buffer, out, gint(strlen(out))); | |||||
gtk_text_buffer_get_iter_at_offset(m_buffer, &start, gint(offset + strlen(in))); | |||||
gtk_text_buffer_place_cursor(m_buffer, &start); | |||||
} | |||||
// set focus on the text, to get back in edition mode directly | |||||
gtk_widget_grab_focus(m_desc); | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CCommentEditorDialog final | |||||
{ | |||||
public: | |||||
CCommentEditorDialog(const Kernel::IKernelContext& ctx, Kernel::IComment& comment, const char* guiFilename) | |||||
: m_kernelCtx(ctx), m_comment(comment), m_guiFilename(guiFilename) { } | |||||
~CCommentEditorDialog() = default; | |||||
bool run(); | |||||
// Callback for text formatting | |||||
void applyTagCB(const char* in, const char* out) const; | |||||
// help formatting pango | |||||
void infoCB() const { gtk_widget_show(m_infoDialog); } | |||||
protected: | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
Kernel::IComment& m_comment; | |||||
CString m_guiFilename; | |||||
GtkBuilder* m_interface = nullptr; | |||||
GtkWidget* m_dialog = nullptr; | |||||
GtkWidget* m_infoDialog = nullptr; | |||||
GtkWidget* m_desc = nullptr; | |||||
GtkTextBuffer* m_buffer = nullptr; | |||||
CCommentEditorDialog() = delete; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCCommentProxy.h" | |||||
#include "ovdTAttributeHandler.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
CCommentProxy::CCommentProxy(const Kernel::IKernelContext& ctx, const Kernel::IComment& comment) | |||||
: m_kernelCtx(ctx), m_constComment(&comment) | |||||
{ | |||||
if (m_constComment) | |||||
{ | |||||
const TAttributeHandler handler(*m_constComment); | |||||
m_centerX = handler.getAttributeValue<int>(OV_AttributeId_Comment_XCenterPosition); | |||||
m_centerY = handler.getAttributeValue<int>(OV_AttributeId_Comment_YCenterPosition); | |||||
} | |||||
} | |||||
CCommentProxy::CCommentProxy(const Kernel::IKernelContext& ctx, Kernel::IScenario& scenario, const CIdentifier& commentID) | |||||
: m_kernelCtx(ctx), m_constComment(scenario.getCommentDetails(commentID)), m_comment(scenario.getCommentDetails(commentID)) | |||||
{ | |||||
if (m_constComment) | |||||
{ | |||||
const TAttributeHandler handler(*m_constComment); | |||||
m_centerX = handler.getAttributeValue<int>(OV_AttributeId_Comment_XCenterPosition); | |||||
m_centerY = handler.getAttributeValue<int>(OV_AttributeId_Comment_YCenterPosition); | |||||
} | |||||
} | |||||
int CCommentProxy::getWidth(GtkWidget* widget) const | |||||
{ | |||||
int x, y; | |||||
updateSize(widget, getLabel(), &x, &y); | |||||
return x; | |||||
} | |||||
int CCommentProxy::getHeight(GtkWidget* widget) const | |||||
{ | |||||
int x, y; | |||||
updateSize(widget, getLabel(), &x, &y); | |||||
return y; | |||||
} | |||||
void CCommentProxy::setCenter(const int centerX, const int centerY) | |||||
{ | |||||
m_centerX = centerX; | |||||
m_centerY = centerY; | |||||
m_applied = false; | |||||
} | |||||
void CCommentProxy::apply() | |||||
{ | |||||
if (m_comment) | |||||
{ | |||||
TAttributeHandler handler(*m_comment); | |||||
if (handler.hasAttribute(OV_AttributeId_Comment_XCenterPosition)) { handler.setAttributeValue<int>(OV_AttributeId_Comment_XCenterPosition, m_centerX); } | |||||
else { handler.addAttribute<int>(OV_AttributeId_Comment_XCenterPosition, m_centerX); } | |||||
if (handler.hasAttribute(OV_AttributeId_Comment_YCenterPosition)) { handler.setAttributeValue<int>(OV_AttributeId_Comment_YCenterPosition, m_centerY); } | |||||
else { handler.addAttribute<int>(OV_AttributeId_Comment_YCenterPosition, m_centerY); } | |||||
m_applied = true; | |||||
} | |||||
} | |||||
const char* CCommentProxy::getLabel() const | |||||
{ | |||||
m_label = m_constComment->getText().toASCIIString(); | |||||
return m_label.c_str(); | |||||
} | |||||
void CCommentProxy::updateSize(GtkWidget* widget, const char* text, int* xSize, int* ySize) | |||||
{ | |||||
PangoRectangle rectangle; | |||||
PangoContext* context = gtk_widget_create_pango_context(widget); | |||||
PangoLayout* layout = pango_layout_new(context); | |||||
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); | |||||
if (pango_parse_markup(text, -1, 0, nullptr, nullptr, nullptr, nullptr)) { pango_layout_set_markup(layout, text, -1); } | |||||
else { pango_layout_set_text(layout, text, -1); } | |||||
pango_layout_get_pixel_extents(layout, nullptr, &rectangle); | |||||
*xSize = rectangle.width; | |||||
*ySize = rectangle.height; | |||||
g_object_unref(layout); | |||||
g_object_unref(context); | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
#include <string> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CCommentProxy final | |||||
{ | |||||
public: | |||||
CCommentProxy(const Kernel::IKernelContext& ctx, const Kernel::IComment& comment); | |||||
CCommentProxy(const Kernel::IKernelContext& ctx, Kernel::IScenario& scenario, const CIdentifier& commentID); | |||||
~CCommentProxy() { if (!m_applied) { this->apply(); } } | |||||
operator Kernel::IComment*() const { return m_comment; } | |||||
operator const Kernel::IComment*() const { return m_constComment; } | |||||
int getWidth(GtkWidget* widget) const; | |||||
int getHeight(GtkWidget* widget) const; | |||||
int getXCenter() const { return m_centerX; } | |||||
int getYCenter() const { return m_centerY; } | |||||
void setCenter(int centerX, int centerY); | |||||
void apply(); | |||||
const char* getLabel() const; | |||||
protected: | |||||
static void updateSize(GtkWidget* widget, const char* text, int* xSize, int* ySize); | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
const Kernel::IComment* m_constComment = nullptr; | |||||
Kernel::IComment* m_comment = nullptr; | |||||
bool m_applied = false; | |||||
int m_centerX = 0; | |||||
int m_centerY = 0; | |||||
mutable std::string m_label; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCConnectorEditor.h" | |||||
#include <map> | |||||
#include <string> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
static void reset_scenario_connector_identifier(GtkWidget* /*widget*/, CConnectorEditor* self) | |||||
{ | |||||
const CIdentifier newID = self->m_Box.getUnusedInputIdentifier(CIdentifier::undefined()); | |||||
if (self->m_IDEntry && newID != CIdentifier::undefined()) { gtk_entry_set_text(self->m_IDEntry, newID.str().c_str()); } | |||||
} | |||||
bool CConnectorEditor::run() | |||||
{ | |||||
//get_identifier_t getID; | |||||
set_name_t setName; | |||||
set_type_t setType; | |||||
is_type_supported_t isTypeSupported; | |||||
//update_identifier_t updateID; | |||||
Kernel::EBoxInterfacorType interfacorType; | |||||
switch (m_type) | |||||
{ | |||||
case Box_Input: | |||||
setName = &Kernel::IBox::setInputName; | |||||
setType = &Kernel::IBox::setInputType; | |||||
isTypeSupported = &Kernel::IBox::hasInputSupport; | |||||
interfacorType = Kernel::Input; | |||||
break; | |||||
case Box_Output: | |||||
setName = &Kernel::IBox::setOutputName; | |||||
setType = &Kernel::IBox::setOutputType; | |||||
isTypeSupported = &Kernel::IBox::hasOutputSupport; | |||||
interfacorType = Kernel::Output; | |||||
break; | |||||
default: | |||||
return false; | |||||
} | |||||
CString name; | |||||
CIdentifier typeID; | |||||
CIdentifier id; | |||||
m_Box.getInterfacorIdentifier(interfacorType, m_index, id); | |||||
m_Box.getInterfacorName(interfacorType, m_index, name); | |||||
m_Box.getInterfacorType(interfacorType, m_index, typeID); | |||||
GtkBuilder* builder = gtk_builder_new(); | |||||
gtk_builder_add_from_file(builder, m_guiFilename.c_str(), nullptr); | |||||
gtk_builder_connect_signals(builder, nullptr); | |||||
GtkWidget* dialog = GTK_WIDGET(gtk_builder_get_object(builder, "connector_editor")); | |||||
GtkEntry* nameEntry = GTK_ENTRY(gtk_builder_get_object(builder, "connector_editor-connector_name_entry")); | |||||
GtkComboBox* typeComboBox = GTK_COMBO_BOX(gtk_builder_get_object(builder, "connector_editor-connector_type_combobox")); | |||||
m_IDEntry = GTK_ENTRY(gtk_builder_get_object(builder, "connector_editor-connector_identifier_entry")); | |||||
GtkButton* idResetButton = GTK_BUTTON(gtk_builder_get_object(builder, "connector_editor-connector_identifier_reset_button")); | |||||
gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(typeComboBox))); | |||||
gtk_window_set_title(GTK_WINDOW(dialog), m_title.c_str()); | |||||
if (m_Box.getAlgorithmClassIdentifier() == CIdentifier::undefined()) | |||||
{ | |||||
gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(builder, "connector_editor-connector_identifier_label"))); | |||||
gtk_widget_show(GTK_WIDGET(m_IDEntry)); | |||||
gtk_widget_show(GTK_WIDGET(idResetButton)); | |||||
g_signal_connect(GTK_WIDGET(idResetButton), "clicked", G_CALLBACK(reset_scenario_connector_identifier), this); | |||||
} | |||||
//get a list of stream types and display connector type | |||||
std::map<std::string, CIdentifier> streamTypes; | |||||
gint active = -1; | |||||
for (const auto& currentTypeID : m_kernelCtx.getTypeManager().getSortedTypes()) | |||||
{ | |||||
//First check if the type is support by the connector | |||||
if ((m_Box.*isTypeSupported)(currentTypeID.first)) | |||||
{ | |||||
//If the input type is support by the connector, let's add it to the list | |||||
if (m_kernelCtx.getTypeManager().isStream(currentTypeID.first)) | |||||
{ | |||||
gtk_combo_box_append_text(typeComboBox, currentTypeID.second.toASCIIString()); | |||||
if (currentTypeID.first == typeID) | |||||
{ | |||||
active = gint(streamTypes.size()); | |||||
gtk_combo_box_set_active(typeComboBox, active); | |||||
} | |||||
streamTypes[currentTypeID.second.toASCIIString()] = currentTypeID.first; | |||||
} | |||||
} | |||||
} | |||||
//display connector name | |||||
gtk_entry_set_text(nameEntry, name.toASCIIString()); | |||||
gtk_entry_set_text(m_IDEntry, id.str().c_str()); | |||||
bool finished = false; | |||||
bool res = false; | |||||
while (!finished) | |||||
{ | |||||
const gint result = gtk_dialog_run(GTK_DIALOG(dialog)); | |||||
if (result == GTK_RESPONSE_APPLY) | |||||
{ | |||||
char* activeText = gtk_combo_box_get_active_text(typeComboBox); | |||||
if (activeText) | |||||
{ | |||||
const auto newName = gtk_entry_get_text(nameEntry); | |||||
auto newType = streamTypes[activeText]; | |||||
const auto newIdStr = gtk_entry_get_text(m_IDEntry); | |||||
(m_Box.*setType)(m_index, newType); | |||||
(m_Box.*setName)(m_index, newName); | |||||
// If the connector identifier is valid then create a new one and swap it with the edited one | |||||
// this is because we can not change the identifier of a setting | |||||
CIdentifier newID; | |||||
if (newID.fromString(newIdStr) && (newID != id)) { m_Box.updateInterfacorIdentifier(interfacorType, m_index, newID); } | |||||
// (m_Box.*addConnector)(newName, newType); | |||||
finished = true; | |||||
res = true; | |||||
} | |||||
} | |||||
else if (result == 2) // revert | |||||
{ | |||||
m_Box.getInterfacorName(interfacorType, m_index, name); | |||||
m_Box.getInterfacorType(interfacorType, m_index, typeID); | |||||
gtk_entry_set_text(nameEntry, name.toASCIIString()); | |||||
gtk_combo_box_set_active(typeComboBox, active); | |||||
} | |||||
else | |||||
{ | |||||
finished = true; | |||||
res = false; | |||||
} | |||||
} | |||||
gtk_widget_destroy(dialog); | |||||
g_object_unref(builder); | |||||
return res; | |||||
} | |||||
} //namespace Designer | |||||
} //namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
#include <string> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
class CConnectorEditor final | |||||
{ | |||||
public: | |||||
CConnectorEditor(const Kernel::IKernelContext& ctx, Kernel::IBox& box, const size_t type, const size_t index, const char* title, const char* guiFilename) | |||||
: m_Box(box), m_kernelCtx(ctx), m_type(type), m_index(index), m_guiFilename(guiFilename), m_title(title ? title : "") { } | |||||
~CConnectorEditor() = default; | |||||
bool run(); | |||||
Kernel::IBox& m_Box; | |||||
GtkEntry* m_IDEntry = nullptr; | |||||
protected: | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
size_t m_type = 0; | |||||
size_t m_index = 0; | |||||
const std::string m_guiFilename; | |||||
const std::string m_title; | |||||
typedef bool (Kernel::IBox::*get_identifier_t)(size_t index, CIdentifier& identifier) const; | |||||
typedef bool (Kernel::IBox::*get_type_t)(size_t index, CIdentifier& typeID) const; | |||||
typedef bool (Kernel::IBox::*get_name_t)(size_t index, CString& name) const; | |||||
typedef bool (Kernel::IBox::*set_type_t)(size_t index, const CIdentifier& typeID); | |||||
typedef bool (Kernel::IBox::*set_name_t)(size_t index, const CString& name); | |||||
typedef bool (Kernel::IBox::*is_type_supported_t)(const CIdentifier& typeID) const; | |||||
typedef bool (Kernel::IBox::*update_identifier_t)(size_t index, const CIdentifier& newID); | |||||
}; | |||||
} //namespace Designer | |||||
} //namespace OpenViBE |
#pragma once | |||||
#include <string> | |||||
#include <vector> | |||||
#include <gtk/gtk.h> | |||||
#include <visualization-toolkit/ovvizIVisualizationTree.h> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
typedef void (*visualization_delete_event_cb_t)(gpointer data); | |||||
class CInterfacedScenario; | |||||
class CDesignerVisualization final : public VisualizationToolkit::ITreeViewCB | |||||
{ | |||||
public: | |||||
CDesignerVisualization(const Kernel::IKernelContext& ctx, VisualizationToolkit::IVisualizationTree& tree, CInterfacedScenario& scenario) | |||||
: m_kernelCtx(ctx), m_tree(tree), m_scenario(scenario) { } | |||||
~CDesignerVisualization() override; | |||||
void init(const std::string& guiFile); | |||||
void load(); | |||||
void show() const; | |||||
void hide(); | |||||
void setDeleteEventCB(visualization_delete_event_cb_t cb, gpointer data); | |||||
void onVisualizationBoxAdded(const Kernel::IBox* box); | |||||
void onVisualizationBoxRemoved(const CIdentifier& boxID); | |||||
void onVisualizationBoxRenamed(const CIdentifier& boxID); | |||||
//ITreeViewCB callbacks overloading | |||||
void createTreeWidget(VisualizationToolkit::IVisualizationWidget* widget) override; | |||||
GtkWidget* loadTreeWidget(VisualizationToolkit::IVisualizationWidget* widget) override; | |||||
void endLoadTreeWidget(VisualizationToolkit::IVisualizationWidget* widget) override; | |||||
GtkWidget* getTreeWidget(GtkWidget* widget) override; | |||||
GtkWidget* getVisualizationWidget(GtkWidget* widget) override; | |||||
const char* getTreeWidgetIcon(VisualizationToolkit::EVisualizationTreeNode type) override; | |||||
//callbacks for dialog | |||||
#ifdef HANDLE_MIN_MAX_EVENTS | |||||
static gboolean window_state_event_cb(GtkWidget* widget, GdkEventWindowState* event, gpointer data); | |||||
#endif | |||||
static gboolean configureEventCB(GtkWidget* widget, GdkEventConfigure* event, gpointer data); | |||||
static gboolean widgetExposeEventCB(GtkWidget* widget, GdkEventExpose* event, gpointer data); | |||||
void resizeCB(VisualizationToolkit::IVisualizationWidget* widget); | |||||
static void notebookPageSwitchCB(GtkNotebook* notebook, GtkNotebookPage* page, guint pagenum, gpointer data); | |||||
//callback for paned handle position changes | |||||
static gboolean notifyPositionPanedCB(GtkWidget* widget, GParamSpec* spec, gpointer data); | |||||
static void askNewVisualizationWindowCB(gpointer data, guint action, GtkWidget* widget); | |||||
static void newVisualizationWindowCB(GtkWidget* widget, gpointer data); | |||||
static void askRenameVisualizationWindowCB(gpointer data, guint action, GtkWidget* widget); | |||||
static void renameVisualizationWindowCB(GtkWidget* widget, gpointer data); | |||||
static void removeVisualizationWindowCB(gpointer data, guint action, GtkWidget* widget); | |||||
static void askNewVisualizationPanelCB(gpointer data, guint action, GtkWidget* widget); | |||||
static void newVisualizationPanelCB(GtkWidget* widget, gpointer data); | |||||
static void askRenameVisualizationPanelCB(gpointer data, guint action, GtkWidget* widget); | |||||
static void renameVisualizationPanelCB(GtkWidget* widget, gpointer data); | |||||
static void removeVisualizationPanelCB(gpointer data, guint action, GtkWidget* widget); | |||||
static void removeVisualizationWidgetCB(gpointer data, guint action, GtkWidget* widget); | |||||
private: | |||||
static gboolean deleteEventCB(GtkWidget* widget, GdkEvent* event, gpointer data); | |||||
bool deleteEvent() const; | |||||
void refreshActiveVisualization(GtkTreePath* selectedItemPath); | |||||
void setActiveVisualization(const char* activeWindow, const char* activePanel); | |||||
GtkTable* newWidgetsTable(); | |||||
void setupNewEventBoxTable(GtkBuilder* xml); | |||||
//visualization windows | |||||
void askNewVisualizationWindow(); | |||||
public: | |||||
bool newVisualizationWindow(const char* label); | |||||
private: | |||||
void askRenameVisualizationWindow(); | |||||
bool renameVisualizationWindow(const char* label); | |||||
bool removeVisualizationWindow(); | |||||
//visualization panels | |||||
void askNewVisualizationPanel(); | |||||
bool newVisualizationPanel(const char* label); | |||||
void askRenameVisualizationPanel(); | |||||
bool renameVisualizationPanel(const char* label); | |||||
bool removeVisualizationPanel(); | |||||
//visualization widgets | |||||
bool removeVisualizationWidget(); | |||||
bool removeVisualizationWidget(const CIdentifier& identifier); | |||||
bool destroyVisualizationWidget(const CIdentifier& identifier); | |||||
void enableNotebookSignals(GtkWidget* notebook, bool b); | |||||
void notebookPageSelectedCB(GtkNotebook* notebook, guint pagenum); | |||||
void enablePanedSignals(GtkWidget* paned, bool b); | |||||
void notifyPositionPaned(GtkWidget* widget); | |||||
//Mouse/Key event callbacks | |||||
static void widgetKeyPressEventCB(GtkWidget* widget, GdkEventKey* event, gpointer data); | |||||
static gboolean widgetEnterNotifyEventCB(GtkWidget* widget, GdkEventCrossing* event, gpointer data); | |||||
static gboolean widgetLeaveNotifyEventCB(GtkWidget* widget, GdkEventCrossing* event, gpointer data); | |||||
//Mouse/Key event methods | |||||
void widgetKeyPressEvent(GtkWidget* widget, GdkEventKey* event); | |||||
void widgetEnterNotifyEvent(GtkWidget* widget, GdkEventCrossing* event); | |||||
void widgetLeaveNotifyEvent(GtkWidget* widget, GdkEventCrossing* event); | |||||
//Tree management callbacks | |||||
static gboolean buttonReleaseCB(GtkWidget* widget, GdkEventButton* event, gpointer data); | |||||
static void cursorChangedCB(GtkTreeView* treeView, gpointer data); | |||||
//Tree management methods | |||||
void buttonRelease(GtkWidget* widget, GdkEventButton* event) const; | |||||
void cursorChanged(GtkTreeView* treeView); | |||||
//Drag methods | |||||
static void dragDataGetFromTreeCB(GtkWidget* srcWidget, GdkDragContext* dc, GtkSelectionData* selection, guint info, guint time, gpointer data); | |||||
static void dragDataGetFromWidgetCB(GtkWidget* srcWidget, GdkDragContext* dc, GtkSelectionData* selection, guint info, guint time, gpointer data); | |||||
//Drop methods | |||||
static void dragDataReceivedInWidgetCB(GtkWidget* dstWidget, GdkDragContext*, gint, gint, GtkSelectionData* selection, guint info, guint time, | |||||
gpointer data); | |||||
static void dataReceivedInEventBoxCB(GtkWidget* dstWidget, GdkDragContext* dc, gint x, gint y, GtkSelectionData* selection, guint info, guint time, | |||||
gpointer data); | |||||
void dragDataReceivedInWidget(GtkWidget* dstWidget, GtkSelectionData* selection); | |||||
void dragDataReceivedInEventBox(GtkWidget* dstWidget, GtkSelectionData* selection, VisualizationToolkit::EDragLocation location); | |||||
const Kernel::IKernelContext& m_kernelCtx; | |||||
VisualizationToolkit::IVisualizationTree& m_tree; | |||||
CInterfacedScenario& m_scenario; | |||||
visualization_delete_event_cb_t m_deleteEventCB = nullptr; | |||||
gpointer m_deleteEventUserData = nullptr; | |||||
std::string m_guiFile; | |||||
GtkTreeView* m_treeView = nullptr; | |||||
GtkWidget* m_dialog = nullptr; | |||||
GtkWidget* m_pane = nullptr; | |||||
//highlighted widget | |||||
GtkWidget* m_highlightedWidget = nullptr; | |||||
//active items | |||||
CString m_activeVisualizationWindowName, m_activeVisualizationPanelName; | |||||
CIdentifier m_activeVisualizationBoxID = CIdentifier::undefined(); | |||||
//preview window visibility flag | |||||
bool m_previewWindowVisible = false; | |||||
size_t m_previewWindowW = 0; | |||||
size_t m_previewWindowH = 0; | |||||
//Factories | |||||
GtkItemFactory* m_unaffectedItemFactory = nullptr; | |||||
GtkItemFactory* m_visualizationWindowItemFactory = nullptr; | |||||
GtkItemFactory* m_visualizationPanelItemFactory = nullptr; | |||||
GtkItemFactory* m_visualizationBoxItemFactory = nullptr; | |||||
GtkItemFactory* m_undefinedItemFactory = nullptr; | |||||
GtkItemFactory* m_splitItemFactory = nullptr; | |||||
std::string m_topEventBoxData; | |||||
std::string m_leftEventBoxData; | |||||
std::string m_rightEventBoxData; | |||||
std::string m_bottomEventBoxData; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#include "ovdCInputDialog.h" | |||||
#include <gdk/gdkkeysyms.h> | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
CInputDialog::CInputDialog(const char* gtkBuilder, const fpButtonCB okButtonCB, void* data, const char* title, const char* label, const char* entry) | |||||
{ | |||||
m_okButtonCB = okButtonCB; | |||||
m_userData = data; | |||||
//retrieve input dialog | |||||
GtkBuilder* builder = gtk_builder_new(); // glade_xml_new(gtkBuilder, "input", nullptr); | |||||
gtk_builder_add_from_file(builder, gtkBuilder, nullptr); | |||||
gtk_builder_connect_signals(builder, nullptr); | |||||
m_dialog = GTK_DIALOG(gtk_builder_get_object(builder, "input")); | |||||
m_dialogLabel = GTK_LABEL(gtk_builder_get_object(builder, "input-label")); | |||||
m_dialogEntry = GTK_ENTRY(gtk_builder_get_object(builder, "input-entry")); | |||||
m_dialogOkButton = GTK_BUTTON(gtk_builder_get_object(builder, "input-button_ok")); | |||||
m_dialogCancelButton = GTK_BUTTON(gtk_builder_get_object(builder, "input-button_cancel")); | |||||
GTK_WIDGET_SET_FLAGS(GTK_WIDGET(m_dialogEntry), GDK_KEY_PRESS_MASK); | |||||
g_signal_connect(G_OBJECT(m_dialogEntry), "key-press-event", G_CALLBACK(keyPressEventCB), m_dialog); | |||||
if (label != nullptr) { gtk_label_set(m_dialogLabel, label); } | |||||
if (entry != nullptr) { gtk_entry_set_text(m_dialogEntry, entry); } | |||||
g_signal_connect(G_OBJECT(m_dialogOkButton), "clicked", G_CALLBACK(buttonClickedCB), this); | |||||
g_signal_connect(G_OBJECT(m_dialogCancelButton), "clicked", G_CALLBACK(buttonClickedCB), this); | |||||
gtk_window_set_position(GTK_WINDOW(m_dialog), GTK_WIN_POS_MOUSE); | |||||
gtk_window_set_title(GTK_WINDOW(m_dialog), title); | |||||
} | |||||
CInputDialog::~CInputDialog() { gtk_widget_destroy(GTK_WIDGET(m_dialog)); } | |||||
void CInputDialog::run() | |||||
{ | |||||
const gint res = gtk_dialog_run(m_dialog); | |||||
if (res == GTK_RESPONSE_ACCEPT) { if (m_okButtonCB != nullptr) { m_okButtonCB(GTK_WIDGET(m_dialogOkButton), this); } } | |||||
gtk_widget_hide_all(GTK_WIDGET(m_dialog)); | |||||
} | |||||
gboolean CInputDialog::keyPressEventCB(GtkWidget* /*widget*/, GdkEventKey* eventKey, gpointer data) | |||||
{ | |||||
if (eventKey->keyval == GDK_Return || eventKey->keyval == GDK_KP_Enter) | |||||
{ | |||||
gtk_dialog_response(GTK_DIALOG(data), GTK_RESPONSE_ACCEPT); | |||||
return TRUE; | |||||
} | |||||
if (eventKey->keyval == GDK_Escape) | |||||
{ | |||||
gtk_dialog_response(GTK_DIALOG(data), GTK_RESPONSE_REJECT); | |||||
return TRUE; | |||||
} | |||||
return FALSE; | |||||
} | |||||
void CInputDialog::buttonClickedCB(GtkButton* button, gpointer data) { static_cast<CInputDialog*>(data)->buttonClicked(button); } | |||||
void CInputDialog::buttonClicked(GtkButton* button) const | |||||
{ | |||||
if (button == m_dialogOkButton) { gtk_dialog_response(m_dialog, GTK_RESPONSE_ACCEPT); } | |||||
else { gtk_dialog_response(m_dialog, GTK_RESPONSE_REJECT); } | |||||
} | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |
#pragma once | |||||
#include "ovd_base.h" | |||||
namespace OpenViBE { | |||||
namespace Designer { | |||||
typedef void (*fpButtonCB)(GtkWidget* pWidget, gpointer data); | |||||
class CInputDialog | |||||
{ | |||||
public: | |||||
CInputDialog(const char* gtkBuilder, fpButtonCB okButtonCB, void* data = nullptr, const char* title = nullptr, const char* label = nullptr, | |||||
const char* entry = nullptr); | |||||
~CInputDialog(); | |||||
void run(); | |||||
void* getUserData() const { return m_userData; } | |||||
const char* getEntry() const { return static_cast<const char*>(gtk_entry_get_text(m_dialogEntry)); } | |||||
private: | |||||
static gboolean keyPressEventCB(GtkWidget* widget, GdkEventKey* eventKey, gpointer data); | |||||
static void buttonClickedCB(GtkButton* button, gpointer data); | |||||
void buttonClicked(GtkButton* button) const; | |||||
void* m_userData = nullptr; | |||||
fpButtonCB m_okButtonCB; | |||||
GtkDialog* m_dialog = nullptr; | |||||
GtkLabel* m_dialogLabel = nullptr; | |||||
GtkEntry* m_dialogEntry = nullptr; | |||||
GtkButton* m_dialogOkButton = nullptr; | |||||
GtkButton* m_dialogCancelButton = nullptr; | |||||
}; | |||||
} // namespace Designer | |||||
} // namespace OpenViBE |