static void pnl_dock_revealer_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height) { PnlDockRevealer *self = (PnlDockRevealer *)widget; PnlDockRevealerPrivate *priv = pnl_dock_revealer_get_instance_private (self); g_assert (PNL_IS_DOCK_REVEALER (self)); g_assert (min_height != NULL); g_assert (nat_height != NULL); pnl_dock_revealer_get_child_preferred_height (self, min_height, nat_height); if (IS_VERTICAL (priv->transition_type) && priv->animation != NULL) { /* * We allow going smaller than the minimum size during animations * and rely on clipping to hide the child. */ *min_height = 0; /* * Our natural height is adjusted for the in-progress animation. */ *nat_height *= gtk_adjustment_get_value (priv->adjustment); } }
static void pnl_dock_revealer_get_child_preferred_height (PnlDockRevealer *self, gint *min_height, gint *nat_height) { PnlDockRevealerPrivate *priv = pnl_dock_revealer_get_instance_private (self); GtkWidget *child; g_assert (PNL_IS_DOCK_REVEALER (self)); g_assert (min_height != NULL); g_assert (nat_height != NULL); *min_height = 0; *nat_height = 0; if (NULL == (child = gtk_bin_get_child (GTK_BIN (self)))) return; if (!gtk_widget_get_child_visible (child) || !gtk_widget_get_visible (child)) return; gtk_widget_get_preferred_height (child, min_height, nat_height); if (IS_VERTICAL (priv->transition_type) && priv->position_set) { if (priv->position > *min_height) *nat_height = priv->position; else *nat_height = *min_height; } }
static void pnl_dock_revealer_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { PnlDockRevealer *self = (PnlDockRevealer *)widget; PnlDockRevealerPrivate *priv = pnl_dock_revealer_get_instance_private (self); GtkAllocation child_allocation; GtkRequisition min_req; GtkRequisition nat_req; GtkWidget *child; g_assert (PNL_IS_DOCK_REVEALER (self)); gtk_widget_set_allocation (widget, allocation); if (gtk_widget_get_realized (GTK_WIDGET (self))) gdk_window_move_resize (priv->window, allocation->x, allocation->y, allocation->width, allocation->height); if (NULL == (child = gtk_bin_get_child (GTK_BIN (self)))) return; if (!gtk_widget_get_child_visible (child)) return; child_allocation.x = 0; child_allocation.y = 0; child_allocation.width = allocation->width; child_allocation.height = allocation->height; if (IS_HORIZONTAL (priv->transition_type)) { pnl_dock_revealer_get_child_preferred_width (self, &min_req.width, &nat_req.width); child_allocation.width = nat_req.width; if (priv->transition_type == PNL_DOCK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT) child_allocation.x = allocation->width - child_allocation.width; } else if (IS_VERTICAL (priv->transition_type)) { pnl_dock_revealer_get_child_preferred_height (self, &min_req.height, &nat_req.height); child_allocation.height = nat_req.height; if (priv->transition_type == PNL_DOCK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN) child_allocation.y = allocation->height - child_allocation.height; } gtk_widget_size_allocate (child, &child_allocation); }
int vertical_parse(unsigned int start, unsigned int length, ld_line_t * program) { int rv = PLC_OK; if(program == NULL) return PLC_ERR; if(program[start] == NULL) return PLC_ERR; item_t or = NULL; int cursor = program[start]->cursor; int current = start; int backtrack = start; int last = start; //first pass: generate OR expression for(;current < length + 1; current++){//for each line if(current == length //overflow || program[current]->cursor < cursor || !IS_VERTICAL(read_char(program[current]->buf, cursor))){ //vertical line interrupted, reset OR expression for(backtrack = current -1; backtrack >= last; backtrack--){ //backtrack, replace all expressions on nodes with OR if(read_char(program[backtrack]->buf, cursor)==LD_NODE) program[backtrack]->stmt = or; } last = current; or = NULL; continue; } if(read_char(program[current]->buf, cursor) == LD_NODE){ //do an OR of all nodes expressions if(program[current]->stmt != NULL) or = mk_expression(program[current]->stmt, or, IL_OR, IL_PUSH); } //otherwise it's LD_OR, just continue program[current]->cursor++; } return rv; }
/// <summary> /// Draws a body /// </summary> /// <param name="pJoints">joint data</param> /// <param name="pJointPoints">joint positions converted to screen space</param> void CBodyBasics::DrawBody(const Joint* pJoints, const D2D1_POINT_2F* pJointPoints) { // Draw the bones // Torso DrawBone(pJoints, pJointPoints, JointType_Head, JointType_Neck); DrawBone(pJoints, pJointPoints, JointType_Neck, JointType_SpineShoulder); DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_SpineMid); DrawBone(pJoints, pJointPoints, JointType_SpineMid, JointType_SpineBase); DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderRight); DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderLeft); DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipRight); DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipLeft); // Right Arm DrawBone(pJoints, pJointPoints, JointType_ShoulderRight, JointType_ElbowRight); DrawBone(pJoints, pJointPoints, JointType_ElbowRight, JointType_WristRight); DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_HandRight); DrawBone(pJoints, pJointPoints, JointType_HandRight, JointType_HandTipRight); DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_ThumbRight); // Left Arm DrawBone(pJoints, pJointPoints, JointType_ShoulderLeft, JointType_ElbowLeft); DrawBone(pJoints, pJointPoints, JointType_ElbowLeft, JointType_WristLeft); DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_HandLeft); DrawBone(pJoints, pJointPoints, JointType_HandLeft, JointType_HandTipLeft); DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_ThumbLeft); // Right Leg DrawBone(pJoints, pJointPoints, JointType_HipRight, JointType_KneeRight); DrawBone(pJoints, pJointPoints, JointType_KneeRight, JointType_AnkleRight); DrawBone(pJoints, pJointPoints, JointType_AnkleRight, JointType_FootRight); // Left Leg DrawBone(pJoints, pJointPoints, JointType_HipLeft, JointType_KneeLeft); DrawBone(pJoints, pJointPoints, JointType_KneeLeft, JointType_AnkleLeft); DrawBone(pJoints, pJointPoints, JointType_AnkleLeft, JointType_FootLeft); // Draw the joints for (int i = 0; i < JointType_Count; ++i) { D2D1_ELLIPSE ellipse = D2D1::Ellipse(pJointPoints[i], c_JointThickness, c_JointThickness); if (pJoints[i].TrackingState == TrackingState_Inferred) { m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred); } else if (pJoints[i].TrackingState == TrackingState_Tracked) { m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked); } } if(frameCount % 10000000 == 0){ float rightShHaX = pJointPoints[JointType_ShoulderRight].x - pJointPoints[JointType_HandRight].x; float rightShHaY = pJointPoints[JointType_ShoulderRight].y - pJointPoints[JointType_HandRight].y; float leftShHaX = pJointPoints[JointType_ShoulderLeft].x - pJointPoints[JointType_HandLeft].x; float leftShHaY = pJointPoints[JointType_ShoulderLeft].y - pJointPoints[JointType_HandLeft].y; float rightShElX = pJointPoints[JointType_ShoulderRight].x - pJointPoints[JointType_ElbowRight].x; float rightShElY = pJointPoints[JointType_ShoulderRight].y - pJointPoints[JointType_ElbowRight].y; float leftShElX = pJointPoints[JointType_ShoulderLeft].x - pJointPoints[JointType_ElbowLeft].x; float leftShElY = pJointPoints[JointType_ShoulderLeft].y - pJointPoints[JointType_ElbowLeft].y; float rightElHaX = pJointPoints[JointType_ElbowRight].x - pJointPoints[JointType_HandRight].x; float rightElHaY = pJointPoints[JointType_ElbowRight].y - pJointPoints[JointType_HandRight].y; float leftElHaX = pJointPoints[JointType_ElbowLeft].x - pJointPoints[JointType_HandLeft].x; float leftElHaY = pJointPoints[JointType_ElbowLeft].y - pJointPoints[JointType_HandLeft].y; float ShHe = pJointPoints[JointType_SpineShoulder].x - pJointPoints[JointType_Head].x; IDWriteTextFormat* m_pTextFormat; ID2D1SolidColorBrush *m_pBlackBrush; m_pRenderTarget->CreateSolidColorBrush( D2D1::ColorF(D2D1::ColorF::Black, 1.0f), &m_pBlackBrush ); //m_pTextFormat = new CD2DTextFormat(GetRenderTarget(), _T("Arial"), 96); //m_pRenderTarget->DrawTextW(L"hello", // ARRAYSIZE("hello") - 1, // m_pTextFormat, // D2D1::RectF(0, 0, 500, 500), // m_pBlackBrush); wchar_t buf[1024]; if (isWrite) { _snwprintf_s(buf, 1024, _TRUNCATE, L"%d\n", 1); } else { _snwprintf_s(buf, 1024, _TRUNCATE, L"%d\n", 0); } OutputDebugString(buf); isWrite = true; if (isWrite) { if (IS_UP_SLANTING(rightShHaY) && IS_HORIZON(leftShHaX)) { //h1 OutputDebugString(L"h1\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add h1 h1"); } if (IS_HORIZON(rightShHaY) && IS_VERTICAL(leftShHaX) ) { //h2 OutputDebugString(L"h2\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add h2 h2"); } if (IS_DOWN_SLANTING(rightShHaY) && IS_VERTICAL(leftShHaX) ) { //h3 OutputDebugString(L"h3\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add h3 h3"); } if (IS_UP_SLANTING(rightShHaY) && IS_UP_SLANTING(leftShHaX) ) { //title OutputDebugString(L"title\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add title title"); } if (IS_DOWN_SLANTING(rightShHaY) && IS_DOWN_SLANTING(leftShHaX)) { //img OutputDebugString(L"img\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add img img"); } if (IS_UP_SLANTING(rightShHaY) && IS_DOWN_SLANTING(leftShHaX)) { //ul OutputDebugString(L"ul\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add ul 3"); } if (IS_DOWN_SLANTING(rightShHaY) && IS_UP_SLANTING(leftShHaX)) { //ol OutputDebugString(L"ol\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add ol 3"); } //if (IS_VERTICAL(rightShElY) && rightShElY > 0 && IS_HORIZON(rightElHaX) && IS_VERTICAL(leftShElY) && leftShElY > 0 && IS_HORIZON(leftElHaX)) { //font // OutputDebugString(L"font\n"); // system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add font font"); //} //if (IS_VERTICAL(leftShElX) && IS_HORIZON(leftElHaY) && IS_VERTICAL(rightShElX) && IS_HORIZON(rightElHaY)) { //u // OutputDebugString(L"u\n"); // system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add u u"); //} //if (IS_HORIZON(leftShElY) && IS_VERTICAL(leftElHaX) && leftElHaY > 0 && IS_HORIZON(rightShElY) && IS_VERTICAL(rightElHaX) && rightElHaY < 0) { //B // OutputDebugString(L"B\n"); // system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add B B"); //} //if (IS_UP_SLANTING(leftShHaX) && IS_VERTICAL(rightShHaX)) { //i // OutputDebugString(L"i\n"); // system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add i i"); //} if (IS_HORIZON(leftShHaY) && IS_HORIZON(rightShHaY) && !IS_VERTICAL(leftShHaX) && !IS_VERTICAL(rightShHaX)) { //p OutputDebugString(L"p\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add p p"); } if (IS_VERTICAL(rightShElY) && IS_HORIZON(rightElHaX) && IS_VERTICAL(leftShElY) && IS_HORIZON(leftElHaX)) { //table OutputDebugString(L"table\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add table 3 3 "); } //if (IS_HORIZON(leftShHaY) && IS_VERTICAL(rightShHaX) && !IS_VERTICAL(ShHe)) { //tr // OutputDebugString(L"tr\n"); // system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add tr tr"); //} if (!IS_VERTICAL(ShHe)&& IS_VERTICAL(rightShHaX) && IS_VERTICAL(leftShHaX) && IS_HORIZON(rightElHaX) && IS_HORIZON(leftElHaX)) { OutputDebugString(L"undo\n"); system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb undo"); } } } }